ScrollView is not Scrolling completely in android - java

I am developing an application in which I am using scrollView in an activity. The scrollview is scrolling but not displaying complete contents. It is not displaying last three contents of the View. This is my complete code. The last three textView from the code TextView32, TextView33, TextView34 is not displaying. Please give me solution for this.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".Sacraments" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"
android:gravity="center"
android:text="#string/com"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="22sp"
android:textStyle="bold" />
<ScrollView
android:id="#+id/ScrollView01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none"
android:layout_below="#+id/textView1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="#string/c"
android:textSize="18sp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView2"
android:layout_below="#+id/textView2"
android:text="#string/c1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView3"
android:layout_alignBottom="#+id/textView3"
android:layout_marginLeft="28dp"
android:layout_toRightOf="#+id/textView2"
android:text="#string/c2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView3"
android:layout_below="#+id/textView3"
android:layout_marginTop="21dp"
android:text="#string/d"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView5"
android:layout_below="#+id/textView5"
android:text="#string/d1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView6"
android:layout_alignBottom="#+id/textView6"
android:layout_marginLeft="28dp"
android:layout_toRightOf="#+id/textView2"
android:text="#string/d2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView6"
android:layout_below="#+id/textView6"
android:layout_marginTop="18dp"
android:text="#string/e"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView8"
android:layout_below="#+id/textView8"
android:text="#string/e1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignLeft="#+id/textView7"
android:text="#string/e2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView9"
android:layout_below="#+id/textView9"
android:layout_marginTop="18dp"
android:text="#string/g"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView11"
android:layout_below="#+id/textView11"
android:text="#string/g1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView12"
android:layout_alignBottom="#+id/textView12"
android:layout_alignLeft="#+id/textView10"
android:text="#string/g2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView12"
android:layout_below="#+id/textView12"
android:layout_marginTop="16dp"
android:text="#string/i"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView14"
android:layout_below="#+id/textView14"
android:text="#string/i1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView13"
android:layout_below="#+id/textView14"
android:text="#string/i2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView15"
android:layout_below="#+id/textView15"
android:layout_marginTop="19dp"
android:text="#string/sa"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView17"
android:layout_below="#+id/textView17"
android:text="#string/sa1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView18"
android:layout_alignBottom="#+id/textView18"
android:layout_alignLeft="#+id/textView16"
android:text="#string/sa2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView18"
android:layout_below="#+id/textView18"
android:layout_marginTop="19dp"
android:text="#string/sv"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView20"
android:layout_below="#+id/textView20"
android:text="#string/sv1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView21"
android:layout_alignBottom="#+id/textView21"
android:layout_alignLeft="#+id/textView19"
android:text="#string/sv2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView21"
android:layout_below="#+id/textView21"
android:layout_marginTop="19dp"
android:text="#string/t"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView23"
android:layout_below="#+id/textView23"
android:text="#string/t1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView24"
android:layout_alignBottom="#+id/textView24"
android:layout_alignLeft="#+id/textView22"
android:text="#string/t2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView26"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView24"
android:layout_below="#+id/textView24"
android:layout_marginTop="19dp"
android:text="#string/tt"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView27"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView26"
android:layout_below="#+id/textView26"
android:text="#string/tt1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView28"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView27"
android:layout_alignBottom="#+id/textView27"
android:layout_alignLeft="#+id/textView25"
android:text="#string/tt2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView29"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView27"
android:layout_below="#+id/textView27"
android:layout_marginTop="19dp"
android:text="#string/ttt"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView30"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView29"
android:layout_below="#+id/textView29"
android:text="#string/ttt1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView30"
android:layout_alignBottom="#+id/textView30"
android:layout_alignLeft="#+id/textView28"
android:text="#string/ttt2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView30"
android:layout_below="#+id/textView30"
android:layout_marginTop="19dp"
android:text="#string/x"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView33"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView32"
android:layout_below="#+id/textView32"
android:text="#string/x1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView34"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView33"
android:layout_alignBottom="#+id/textView33"
android:layout_alignLeft="#+id/textView31"
android:text="#string/x2"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Not scrolling after XAVERITIES

replace your xml code with this....
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".Sacraments" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"
android:gravity="center"
android:text="#string/com"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="22sp"
android:textStyle="bold" />
<ScrollView
android:id="#+id/ScrollView01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none"
android:layout_below="#+id/textView1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="#string/c"
android:textSize="18sp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView2"
android:layout_below="#+id/textView2"
android:text="#string/c1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView3"
android:layout_alignBottom="#+id/textView3"
android:layout_marginLeft="28dp"
android:layout_toRightOf="#+id/textView2"
android:text="#string/c2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView3"
android:layout_below="#+id/textView3"
android:layout_marginTop="21dp"
android:text="#string/d"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView5"
android:layout_below="#+id/textView5"
android:text="#string/d1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView6"
android:layout_alignBottom="#+id/textView6"
android:layout_marginLeft="28dp"
android:layout_toRightOf="#+id/textView2"
android:text="#string/d2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView6"
android:layout_below="#+id/textView6"
android:layout_marginTop="18dp"
android:text="#string/e"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView8"
android:layout_below="#+id/textView8"
android:text="#string/e1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView9"
android:layout_alignBottom="#+id/textView9"
android:layout_alignLeft="#+id/textView7"
android:text="#string/e2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView9"
android:layout_below="#+id/textView9"
android:layout_marginTop="18dp"
android:text="#string/g"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView11"
android:layout_below="#+id/textView11"
android:text="#string/g1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView12"
android:layout_alignBottom="#+id/textView12"
android:layout_alignLeft="#+id/textView10"
android:text="#string/g2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView12"
android:layout_below="#+id/textView12"
android:layout_marginTop="16dp"
android:text="#string/i"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView14"
android:layout_below="#+id/textView14"
android:text="#string/i1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView13"
android:layout_below="#+id/textView14"
android:text="#string/i2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView15"
android:layout_below="#+id/textView15"
android:layout_marginTop="19dp"
android:text="#string/sa"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView17"
android:layout_below="#+id/textView17"
android:text="#string/sa1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView18"
android:layout_alignBottom="#+id/textView18"
android:layout_alignLeft="#+id/textView16"
android:text="#string/sa2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView18"
android:layout_below="#+id/textView18"
android:layout_marginTop="19dp"
android:text="#string/sv"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView20"
android:layout_below="#+id/textView20"
android:text="#string/sv1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView21"
android:layout_alignBottom="#+id/textView21"
android:layout_alignLeft="#+id/textView19"
android:text="#string/sv2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView21"
android:layout_below="#+id/textView21"
android:layout_marginTop="19dp"
android:text="#string/t"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView23"
android:layout_below="#+id/textView23"
android:text="#string/t1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView24"
android:layout_alignBottom="#+id/textView24"
android:layout_alignLeft="#+id/textView22"
android:text="#string/t2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView26"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView24"
android:layout_below="#+id/textView24"
android:layout_marginTop="19dp"
android:text="#string/tt"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView27"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView26"
android:layout_below="#+id/textView26"
android:text="#string/tt1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView28"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView27"
android:layout_alignBottom="#+id/textView27"
android:layout_alignLeft="#+id/textView25"
android:text="#string/tt2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView29"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView27"
android:layout_below="#+id/textView27"
android:layout_marginTop="19dp"
android:text="#string/ttt"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView30"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView29"
android:layout_below="#+id/textView29"
android:text="#string/ttt1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView31"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView30"
android:layout_alignBottom="#+id/textView30"
android:layout_alignLeft="#+id/textView28"
android:text="#string/ttt2"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView32"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView30"
android:layout_below="#+id/textView30"
android:layout_marginTop="19dp"
android:text="#string/x"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView33"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView32"
android:layout_below="#+id/textView32"
android:text="#string/x1"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/textView34"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView33"
android:layout_alignBottom="#+id/textView33"
android:layout_alignLeft="#+id/textView31"
android:text="#string/x2"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>

Check below lines and replace and try,
<ScrollView
android:id="#+id/ScrollView01"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none"
android:layout_below="#+id/textView1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
</LinearLayout>
</ScrollView>

Related

.IllegalStateException: ScrollView can host only one direct child

I am trying very hard to understand the ScrollView and Linearlayout and constantly trying to use inside my activity but I"m getting this error..I already have only one Linearlyout inside scroll view and other child are wrapped in wrap content both height and width but still the app crashes..Please help
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#ffffff"
tools:context=".Blood">
<TextView
android:layout_width="wrap_content"
android:layout_height="56dp"
android:textStyle="bold"
android:background="#f4051d"
android:textAlignment="center"
android:textColor="#ffffff"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Blood Type: Facts and Information"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#ffffff"
android:padding="5dp">
<TextView
android:id="#+id/intro"
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#000000"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="When "/>
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Blood Types ( Groups )"/>
<TextView
android:id="#+id/blood_types"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="A blood "
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<ImageView
android:id="#+id/image_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/drawable_blood_one"/>
<TextView
android:id="#+id/blood_type_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="In addition ."
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Donating Blood By Compatible Type"/>
<TextView
android:id="#+id/donate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="Blood "
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<ImageView
android:id="#+id/image_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/drawable_blood_two"/>
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Finding Out Your Blood Type"/>
<TextView
android:id="#+id/find_blood_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="It is easy "
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<ImageView
android:id="#+id/image_three"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/drawable_blood_three"/>
<TextView
android:id="#+id/find_blood_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="In most"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="What Does Blood Group RH Factor Mean"/>
<TextView
android:id="#+id/rh_factor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="RH factor ."
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="What is the Rarest Blood Type"/>
<TextView
android:id="#+id/rare_blood"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="According "
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Blood Type Diet"/>
<TextView
android:id="#+id/blood_type_diet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text=" The Ea"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Blood Types and Personality"/>
<TextView
android:id="#+id/personality"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="Legend"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Facts: Blood Types"/>
<TextView
android:id="#+id/facts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="Blood"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
</ScrollView>
</LinearLayout>
Thanks in advance.
You need to have only one child in ScrollView like this.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView ... />
<TextView ... />
<TextView ... />
<TextView ... />
</LinearLayout>
</ScrollView>
No, you have one SrollView inside a LinearLayout. Your ScrollView just has a bunch of TextViews in it. Change it to this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#ffffff"
tools:context=".Blood">
<TextView
android:layout_width="wrap_content"
android:layout_height="56dp"
android:textStyle="bold"
android:background="#f4051d"
android:textAlignment="center"
android:textColor="#ffffff"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Blood Type: Facts and Information"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#ffffff"
android:padding="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/intro"
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#000000"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="When "/>
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Blood Types ( Groups )"/>
<TextView
android:id="#+id/blood_types"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="A blood "
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<ImageView
android:id="#+id/image_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/drawable_blood_one"/>
<TextView
android:id="#+id/blood_type_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="In addition ."
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Donating Blood By Compatible Type"/>
<TextView
android:id="#+id/donate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="Blood "
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<ImageView
android:id="#+id/image_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/drawable_blood_two"/>
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Finding Out Your Blood Type"/>
<TextView
android:id="#+id/find_blood_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="It is easy "
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<ImageView
android:id="#+id/image_three"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/drawable_blood_three"/>
<TextView
android:id="#+id/find_blood_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="In most"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="What Does Blood Group RH Factor Mean"/>
<TextView
android:id="#+id/rh_factor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="RH factor ."
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="What is the Rarest Blood Type"/>
<TextView
android:id="#+id/rare_blood"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="According "
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Blood Type Diet"/>
<TextView
android:id="#+id/blood_type_diet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text=" The Ea"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Blood Types and Personality"/>
<TextView
android:id="#+id/personality"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="Legend"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#0e06f2"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Facts: Blood Types"/>
<TextView
android:id="#+id/facts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:fontFamily="sans-serif-condensed"
android:text="Blood"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textStyle="bold" />
</LinearLayout>
</ScrollView>
</LinearLayout>

Circular dependencies cannot exist in Relative Layout

I am a newbie in android. Got stuck cannot move forward without this. I don't understand where I am doing the mistake. Looked through the code for 2 hours but cannot find the error. I need serious help. Thank u in advance.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:toomove ls="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimaryDark"
android:padding="16dp"
tools:context="com.zodiac.sanghvi.jplreborn.Admin_ScoreCard">
<TextView
android:id="#+id/Vs"
android:textColor="#f8f8f9"
android:gravity="center"
android:textSize="20sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="Team1 Vs Team2"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<TextView
android:id="#+id/BatsMen1"
android:textColor="#f8f8f9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:text="TextView"
android:layout_below="#+id/textView7"
android:layout_centerHorizontal="true" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#f8f8f9"
android:layout_marginTop="25sp"
android:text="Batting :"
android:textSize="17sp"
android:layout_below="#+id/Vs"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="#+id/Batting"
android:gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#f8f8f9"
android:text="TextView"
android:layout_above="#+id/BatsMen1"
android:layout_toLeftOf="#+id/textView6"
android:layout_toStartOf="#+id/textView6" />
<TextView
android:id="#+id/BatsMen2"
android:textColor="#f8f8f9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/BatsMen1"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="TextView" />
<TextView
android:id="#+id/textView5"
android:textColor="#f8f8f9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:text="Bowling :"
android:textSize="17sp"
android:layout_below="#+id/BatsMen2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="#+id/Bowling"
android:textColor="#f8f8f9"
android:gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView5"
android:layout_alignEnd="#+id/Batting"
android:layout_alignRight="#+id/Batting"
android:text="TextView" />
<TextView
android:id="#+id/Bowler"
android:layout_width="match_parent"
android:textColor="#f8f8f9"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:text="TextView"
android:layout_below="#+id/Bowling"
android:layout_centerHorizontal="true" />
<EditText
android:id="#+id/Runs"
android:layout_width="80dp"
android:layout_height="60dp"
android:background="#f8f8f9"
android:textSize="35sp"
android:padding="9dp"
android:ems="10"
android:inputType="numberSigned" />
<EditText
android:id="#+id/Wickets"
android:layout_width="60dp"
android:layout_height="60dp"
android:background="#f8f8f9"
android:textSize="35sp"
android:padding="9dp"
android:ems="10"
android:inputType="numberSigned"
android:layout_marginRight="27dp"
android:layout_marginEnd="27dp"
android:layout_alignBaseline="#+id/Runs"
android:layout_alignBottom="#+id/Runs"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:layout_alignParentBottom="true"
android:layout_alignRight="#+id/Runs"
android:layout_alignEnd="#+id/Runs"
android:layout_marginBottom="48dp" />
<TextView
android:id="#+id/textView4"
android:textColor="#f8f8f9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/Overs"
android:layout_alignStart="#+id/Overs"
android:layout_below="#+id/Overs"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="Overs"
android:layout_alignRight="#+id/Overs"
android:layout_alignEnd="#+id/Overs" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#f8f8f9"
android:text="Runs"
android:layout_below="#+id/Runs"
android:layout_centerHorizontal="true"
android:layout_marginTop="18dp" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/Wickets"
android:layout_alignStart="#+id/Wickets"
android:layout_alignTop="#+id/textView6"
android:textColor="#f8f8f9"
android:text="Wickets"
android:gravity="center"
android:layout_alignRight="#+id/Wickets"
android:layout_alignEnd="#+id/Wickets" />
<TextView
android:id="#+id/Choose"
android:textColor="#f8f8f9"
android:textSize="10sp"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/Vs"
android:text="Sultan Won The Toss And Choose to Bat"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<TextView
android:id="#+id/Overs"
android:layout_width="60dp"
android:layout_height="60dp"
android:text="TextView"
android:gravity="center"
android:background="#f8f8f9"
android:layout_marginTop="71dp"
android:layout_below="#+id/Bowler"
android:layout_toRightOf="#+id/textView4"
android:layout_toEndOf="#+id/textView4" />
</RelativeLayout>
TextView with id textView4 and TextView with id Overs are creating this circular dependency because:
TextView with id textView4 is alignLeft and alignRight to the TextView with id Overs. Again, TextView with id Overs is toRightOf to the TextView with id textView4.
It's not possible because they can't be dependent on each other.

Why shows the emulator not the whole layout in Android Studio?

I'm using Android Studio since some weeks. After my first experience I'm building my first APK und have a problem with the Relative layout.
After I'm putting the stuff (ImageBtn, TextView) into it and trying to run the app in the emulator, it shows only the left side.
enter image description here
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="match_parent">
<ImageButton
android:id="#+id/imageButton5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:background="#android:color/background_light"
app:srcCompat="#drawable/beer" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageButton5"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_toEndOf="#+id/imageButton5"
android:layout_toRightOf="#+id/imageButton5"
android:text="Beer"
android:textSize="18sp" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="7dp"
android:text="Level 0"
android:textSize="18sp"
android:layout_alignBottom="#+id/imageButton5"
android:layout_alignLeft="#+id/textView11"
android:layout_alignStart="#+id/textView11" />
<ImageButton
android:id="#+id/imageButton6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="110dp"
android:background="#android:color/background_light"
app:srcCompat="#drawable/frenchfries" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView11"
android:layout_alignStart="#+id/textView11"
android:layout_alignTop="#+id/imageButton6"
android:text="French Frits"
android:textSize="18sp" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Level 0"
android:textSize="18sp"
android:layout_centerVertical="true"
android:layout_alignLeft="#+id/textView13"
android:layout_alignStart="#+id/textView13" />
<ImageButton
android:id="#+id/imageButton7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="190dp"
android:background="#android:color/background_light"
app:srcCompat="#drawable/icecream" />
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView14"
android:layout_alignStart="#+id/textView14"
android:layout_alignTop="#+id/imageButton7"
android:text="Ice Cream"
android:textSize="18sp" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView15"
android:layout_alignStart="#+id/textView15"
android:layout_below="#+id/textView15"
android:text="Level 0"
android:textSize="18sp" />
<ImageButton
android:id="#+id/imageButton9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/background_light"
app:srcCompat="#drawable/pizza"
android:layout_alignTop="#+id/textView11"
android:layout_toRightOf="#+id/textView13"
android:layout_toEndOf="#+id/textView13"
android:layout_marginLeft="28dp"
android:layout_marginStart="28dp" />
<TextView
android:id="#+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView12"
android:layout_marginLeft="14dp"
android:layout_marginStart="14dp"
android:layout_toEndOf="#+id/imageButton9"
android:layout_toRightOf="#+id/imageButton9"
android:text="Pizza"
android:textSize="18sp" />
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Level 0"
android:textSize="18sp"
android:layout_below="#+id/textView11"
android:layout_alignLeft="#+id/textView17"
android:layout_alignStart="#+id/textView17" />
<TextView
android:id="#+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView15"
android:layout_marginLeft="102dp"
android:layout_marginStart="102dp"
android:layout_toEndOf="#+id/textView18"
android:layout_toRightOf="#+id/textView18"
android:text="TextView" />
</RelativeLayout>
Hope you can help me to fix that problem.
Greetings Phil Newman
I will present two ways I would do this if it was me. So you can also choose from this to suit your need.
METHOD ONE
You can use a LinearLayout with vertical orientation as the parent layout.
Use another LinearLayout with horizontal orientation to host a two RelativeLayouts. Each RelativeLayout will also contain the three components(ImageButton, TextViews).
Looks at an xml text I have presented here:
<LinearLayout
android:id="#+id/lay1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".50">
<ImageButton
android:id="#+id/imageButton5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:background="#android:color/background_light"
app:srcCompat="#drawable/beer" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageButton5"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_toEndOf="#+id/imageButton5"
android:layout_toRightOf="#+id/imageButton5"
android:text="Beer"
android:textSize="18sp" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="7dp"
android:text="Level 0"
android:textSize="18sp"
android:layout_alignBottom="#+id/imageButton5"
android:layout_alignLeft="#+id/textView11"
android:layout_alignStart="#+id/textView11" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".50">
<ImageButton
android:id="#+id/imageButton6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:background="#android:color/background_light"
app:srcCompat="#drawable/frenchfries" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageButton6"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_toEndOf="#+id/imageButton6"
android:layout_toRightOf="#+id/imageButton6"
android:text="French Frits"
android:textSize="18sp" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="7dp"
android:text="Level 0"
android:textSize="18sp"
android:layout_alignBottom="#+id/imageButton6"
android:layout_alignLeft="#+id/textView1"
android:layout_alignStart="#+id/textView1" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/lay2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".50">
<ImageButton
android:id="#+id/imageButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:background="#android:color/background_light"
app:srcCompat="#drawable/icecream" />
<TextView
android:id="#+id/textView0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageButton2"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_toEndOf="#+id/imageButton2"
android:layout_toRightOf="#+id/imageButton2"
android:text="Ice Cream"
android:textSize="18sp" />
<TextView
android:id="#+id/textView102"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="7dp"
android:text="Level 0"
android:textSize="18sp"
android:layout_alignBottom="#+id/imageButton2"
android:layout_alignLeft="#+id/textView0"
android:layout_alignStart="#+id/textView0" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".50">
<ImageButton
android:id="#+id/imageButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:background="#android:color/background_light"
app:srcCompat="#drawable/pizza" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageButton3"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_toEndOf="#+id/imageButton3"
android:layout_toRightOf="#+id/imageButton3"
android:text="Pizza"
android:textSize="18sp" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="7dp"
android:text="Level 0"
android:textSize="18sp"
android:layout_alignBottom="#+id/imageButton3"
android:layout_alignLeft="#+id/textView3"
android:layout_alignStart="#+id/textView3" />
</RelativeLayout>
</LinearLayout>
You can analyse it carefully and just copy and paste depending on the number of buttons(your categories) you want.
METHOD TWO
Arrange everything well in the Relative layout (linearly or preferably a LinearLayout) and put the RelativeLayout in a ScrollView layout as the parent layout. This will enable the user to scroll down and up if the widgets are out of view.
Also here is an xml for that:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/imageButton5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:background="#android:color/background_light"
app:srcCompat="#drawable/beer" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imageButton5"
android:layout_marginLeft="12dp"
android:layout_marginStart="12dp"
android:layout_toEndOf="#+id/imageButton5"
android:layout_toRightOf="#+id/imageButton5"
android:text="Beer"
android:textSize="18sp" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="7dp"
android:text="Level 0"
android:textSize="18sp"
android:layout_alignBottom="#+id/imageButton5"
android:layout_alignLeft="#+id/textView11"
android:layout_alignStart="#+id/textView11" />
<ImageButton
android:id="#+id/imageButton6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="110dp"
android:background="#android:color/background_light"
app:srcCompat="#drawable/frenchfries" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView11"
android:layout_alignStart="#+id/textView11"
android:layout_alignTop="#+id/imageButton6"
android:text="French Frits"
android:textSize="18sp" />
<!-- android:layout_marginBottom="7dp" -->
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="7dp"
android:text="Level 0"
android:textSize="18sp"
android:layout_alignBottom="#+id/imageButton6"
android:layout_alignLeft="#+id/textView13"
android:layout_alignStart="#+id/textView13"/>
<ImageButton
android:id="#+id/imageButton7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="190dp"
android:background="#android:color/background_light"
app:srcCompat="#drawable/icecream" />
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView14"
android:layout_alignStart="#+id/textView14"
android:layout_alignTop="#+id/imageButton7"
android:text="Ice Cream"
android:textSize="18sp" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView15"
android:layout_alignStart="#+id/textView15"
android:layout_below="#+id/textView15"
android:text="Level 0"
android:textSize="18sp" />
<ImageButton
android:id="#+id/imageButton9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/background_light"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="270dp"
app:srcCompat="#drawable/pizza" />
<TextView
android:id="#+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView16"
android:layout_alignStart="#+id/textView16"
android:layout_alignTop="#+id/imageButton9"
android:text="Pizza"
android:textSize="18sp" />
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Level 0"
android:textSize="18sp"
android:layout_alignLeft="#+id/textView17"
android:layout_alignStart="#+id/textView17"
android:layout_below="#+id/textView17" />
</RelativeLayout>

Android App is not fitting to different screen sizes

I am almost done with this app, but now that I test it on different devices, all the elements aren't fitting the same way. How do I make it scalable to fit different screens? Or do i have to remake the entire UI from scratch?
XML File
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.example.rugpacalc.MainActivity$PlaceholderFragment" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView1"
android:layout_marginLeft="35dp"
android:layout_toRightOf="#+id/textView1"
android:text="Credit " />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView2"
android:layout_alignBottom="#+id/textView2"
android:layout_marginLeft="27dp"
android:layout_toRightOf="#+id/textView2"
android:text="Grade " />
<EditText
android:id="#+id/Course1"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView1"
android:ems="10" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/editText3"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText2"
android:ems="10" />
<EditText
android:id="#+id/editText4"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText3"
android:ems="10" />
<EditText
android:id="#+id/editText5"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText4"
android:ems="10" />
<EditText
android:id="#+id/editText6"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editText5"
android:ems="10" />
<EditText
android:id="#+id/editText8"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText2"
android:layout_alignBottom="#+id/editText2"
android:layout_alignLeft="#+id/editText7"
android:ems="10"
android:inputType="numberDecimal" />
<EditText
android:id="#+id/editText9"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText3"
android:layout_alignBottom="#+id/editText3"
android:layout_alignLeft="#+id/editText8"
android:ems="10"
android:inputType="numberDecimal" />
<EditText
android:id="#+id/editText10"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText4"
android:layout_alignBottom="#+id/editText4"
android:layout_alignLeft="#+id/editText9"
android:ems="10"
android:inputType="numberDecimal" />
<EditText
android:id="#+id/editText11"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText5"
android:layout_alignBottom="#+id/editText5"
android:layout_alignLeft="#+id/editText10"
android:ems="10"
android:inputType="numberDecimal" />
<EditText
android:id="#+id/editText12"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText11"
android:layout_below="#+id/editText5"
android:ems="10"
android:inputType="numberDecimal" />
<EditText
android:id="#+id/editText13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView3"
android:layout_alignRight="#+id/textView3"
android:layout_below="#+id/textView2"
android:ems="10" />
<EditText
android:id="#+id/editText14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText8"
android:layout_alignBottom="#+id/editText8"
android:layout_alignLeft="#+id/editText13"
android:layout_alignRight="#+id/editText13"
android:ems="10" />
<EditText
android:id="#+id/editText15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText9"
android:layout_alignBottom="#+id/editText9"
android:layout_alignLeft="#+id/editText14"
android:layout_alignRight="#+id/editText14"
android:ems="10" />
<EditText
android:id="#+id/editText16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText10"
android:layout_alignBottom="#+id/editText10"
android:layout_alignLeft="#+id/editText15"
android:layout_alignRight="#+id/editText15"
android:ems="10" />
<EditText
android:id="#+id/editText17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText11"
android:layout_alignBottom="#+id/editText11"
android:layout_alignLeft="#+id/editText16"
android:layout_alignRight="#+id/editText16"
android:ems="10" />
<EditText
android:id="#+id/editText18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/editText12"
android:layout_alignBottom="#+id/editText12"
android:layout_alignLeft="#+id/editText17"
android:layout_alignRight="#+id/editText17"
android:ems="10" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/editText13"
android:layout_alignParentRight="true"
android:text="" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/editText14"
android:layout_alignParentRight="true"
android:text="" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/editText16"
android:layout_alignParentRight="true"
android:text="" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/editText16"
android:layout_alignParentRight="true"
android:text="" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/editText17"
android:layout_alignParentRight="true"
android:text="" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/editText18"
android:layout_alignParentRight="true"
android:text="" />
<EditText
android:id="#+id/editText7"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_above="#+id/editText8"
android:layout_toRightOf="#+id/Course1"
android:ems="10"
android:hint=""
android:inputType="number|numberDecimal" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView3"
android:layout_alignParentRight="true"
android:text="CreditEd" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView11"
android:layout_below="#+id/textView11"
android:text="Total Credit Pts Earned:" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView12"
android:layout_below="#+id/textView12"
android:text="Cumulative GPA:" />
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView13"
android:layout_below="#+id/textView13"
android:layout_marginTop="14dp"
android:text="Semester Credits" />
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView14"
android:text="Semester Credit Points:" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView15"
android:layout_below="#+id/textView15"
android:text="Semester GPA:" />
<TextView
android:id="#+id/textView17"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView11"
android:layout_toLeftOf="#+id/textView4"
android:text="" />
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView12"
android:layout_alignBottom="#+id/textView12"
android:layout_alignRight="#+id/textView17"
android:text="" />
<TextView
android:id="#+id/textView19"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/textView18"
android:layout_below="#+id/textView18"
android:text="" />
<TextView
android:id="#+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView15"
android:layout_alignLeft="#+id/textView19"
android:text="" />
<TextView
android:id="#+id/textView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView15"
android:layout_alignBottom="#+id/textView15"
android:layout_alignRight="#+id/textView20"
android:text="" />
<TextView
android:id="#+id/textView22"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/textView21"
android:layout_below="#+id/textView21"
android:text="" />
<TextView
android:id="#+id/tv23"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView17"
android:layout_toRightOf="#+id/editText18"
android:text="TextView" />
<TextView
android:id="#+id/tv24"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView18"
android:layout_alignBottom="#+id/textView18"
android:layout_alignLeft="#+id/tv23"
android:text="TextView" />
<TextView
android:id="#+id/tv25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView14"
android:layout_alignLeft="#+id/tv24"
android:text="TextView" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView15"
android:layout_below="#+id/button2"
android:text="Total Credits Completed:" />
<Button
android:id="#+id/button1"
android:layout_width="60dp"
android:layout_height="35dp"
android:layout_alignLeft="#+id/button2"
android:layout_alignRight="#+id/textView08"
android:layout_below="#+id/editText6"
android:layout_marginTop="70dp"
android:text="Calculate" />
<Button
android:id="#+id/button2"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignLeft="#+id/textView11"
android:layout_alignRight="#+id/textView08"
android:layout_below="#+id/button1"
android:text="Next" />
<EditText
android:id="#+id/EditText01"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/editText6"
android:layout_below="#+id/editText6"
android:ems="10" />
<EditText
android:id="#+id/EditText02"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/button1"
android:layout_below="#+id/EditText01"
android:ems="10" />
<EditText
android:id="#+id/EditText05"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/EditText04"
android:layout_alignLeft="#+id/editText18"
android:layout_alignRight="#+id/editText18"
android:ems="10" />
<EditText
android:id="#+id/EditText06"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/EditText05"
android:layout_alignRight="#+id/EditText05"
android:layout_below="#+id/EditText03"
android:ems="10" />
<TextView
android:id="#+id/textView07"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/EditText05"
android:layout_alignParentRight="true" />
<TextView
android:id="#+id/textView08"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/EditText06"
android:layout_alignParentRight="true" />
<EditText
android:id="#+id/editText2"
android:layout_width="90dp"
android:layout_height="wrap_content"
android:layout_below="#+id/Course1"
android:layout_toLeftOf="#+id/editText8"
android:ems="10" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/Course1"
android:layout_alignParentTop="true"
android:layout_marginTop="42dp"
android:text="Course" />
<EditText
android:id="#+id/EditText03"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_above="#+id/EditText02"
android:layout_toRightOf="#+id/EditText01"
android:ems="10"
android:inputType="numberDecimal" />
<EditText
android:id="#+id/EditText04"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_below="#+id/EditText01"
android:layout_toRightOf="#+id/EditText01"
android:ems="10"
android:inputType="numberDecimal" />
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignLeft="#+id/textView1"
android:layout_alignParentTop="true"
android:ems="10"
android:hint="Enter Semester" />
</RelativeLayout>
The answer would be too large... If you mean to keep the proportions you can use weight rather than dps. Anyway I recomend you to read this article:
http://developer.android.com/guide/practices/screens_support.html

RelativeLayout and ScrollView

I have a problem about RelativeLayout,i dunno know how to add a scrollview,i want to keep all my object in a relative layout and i dont want to add another linearlayout,also please notice that i have a background set in my RelativeLayout,Thanks you,i also have a problem when using .gone function for my imageview in a relative layout,the image reapear when the view is updated,i had not this pb when using a linearlayout here is my code :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.80"
android:background="#drawable/questionggreen"
android:orientation="vertical"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"
android:clipToPadding="true"
android:orientation="vertical" >
<RadioButton
android:id="#+id/radio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 24 Juin 1944"
android:textColor="#ff00ff"
android:textSize="19dp"
android:textStyle="bold" />
<RadioButton
android:id="#+id/radio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 9 Decembre 1988"
android:textColor="#ff00ff"
android:textSize="19dp"
android:textStyle="bold" />
<RadioButton
android:id="#+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="14 octobre 1978"
android:textColor="#ff00ff"
android:textSize="19dp"
android:textStyle="bold" />
<TextView
android:id="#+id/Chrono"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000"
android:textStyle="bold" android:layout_marginTop="2dp"/>
</RadioGroup>
<TextView
android:id="#+id/Lareponseetait"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
<TextView
android:id="#+id/QuestionNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_weight="1.26"
android:text="Question 1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#00ff00"
android:textStyle="normal|bold" />
<TextView
android:id="#+id/Question"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/QuestionNumber"
android:layout_marginTop="30dp"
android:text="Quelle est la date de naissance de Usher ?"
android:textColor="#FFFACD"
android:textSize="16dp"
android:textStyle="normal|bold"
android:typeface="sans" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="158dp"
android:layout_height="154dp"
android:layout_below="#id/Question"
android:layout_centerHorizontal="true"
android:layout_marginTop="32dp"
android:src="#drawable/mzl"
android:visibility="gone" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_weight="1.26"
android:text="CELB"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/Goodanswercount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/Goodanswercount"
android:layout_alignLeft="#+id/radioGroup1"
android:layout_alignParentRight="true"
android:layout_below="#+id/radioGroup1"
android:layout_marginTop="3dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#00ff00"
android:textStyle="bold" android:layout_toRightOf="#id/textView1"/>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignTop="#+id/Goodanswercount"
android:text="Correct :"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#00ff00" android:layout_marginTop="3dp"/>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/Goodanswercount"
android:text="Wrong :"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff0000" android:layout_toLeftOf="#+id/Goodanswercount"/>
<TextView
android:id="#+id/Wronganswercount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView2"
android:layout_toRightOf="#+id/textView2"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ff0000"
android:textStyle="bold" />
<TextView
android:id="#+id/Lareponseetait"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/QuestionNumber"
android:text="La reponse etait :"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff0000" android:layout_marginTop="5dp"/>
<TextView
android:id="#+id/Lareponsecorrectetait"
android:layout_width="215dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/Lareponseetait"
android:layout_alignBottom="#+id/Lareponseetait"
android:layout_alignParentRight="true"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff0000" />
<TextView
android:id="#+id/Scores1"
android:layout_width="29dp"
android:layout_height="wrap_content"
android:layout_above="#+id/Question"
android:layout_alignParentRight="true"
android:text="000"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff00ff"
android:textStyle="bold" />
<TextView
android:id="#+id/Scores"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/Question"
android:layout_toLeftOf="#+id/Scores1"
android:text="Scores : 00"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff00ff"
android:textStyle="bold" />
<ImageButton
android:id="#+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView2"
android:layout_centerHorizontal="true"
android:src="#drawable/buttonok" android:layout_marginTop="10dp"/>
<CheckBox
android:id="#+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/imageButton1"
android:text="Sounds Off" android:layout_marginTop="3dp"/>
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/checkBox1"
android:layout_alignBottom="#+id/checkBox1"
android:layout_alignParentLeft="true"
android:text="Quit" />
</RelativeLayout>
Try this. it's helpful for you...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:weightSum="1"
android:background="#drawable/background">
<ScrollView android:layout_height="wrap_content" android:layout_width="match_parent" android:id="#+id/scrollView1" android:layout_weight="0.97">
<RelativeLayout android:id="#+id/relativeLayout1" android:layout_width="match_parent" android:layout_height="444dp">
<TextView android:id="#+id/textView1" android:textColor="#color/myGreenColor" android:text="Enter Roll Number and Exam hear" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true"></TextView>
<ImageView android:src="#drawable/result" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="#+id/imageView1" android:layout_below="#+id/textView1" android:layout_alignParentLeft="true" android:layout_marginTop="22dp" android:layout_alignParentRight="true"></ImageView>
<Spinner android:layout_height="wrap_content" android:layout_below="#+id/imageView1" android:layout_alignParentRight="true" android:layout_marginTop="32dp" android:layout_width="150dp" android:id="#+id/searchRsult_spinner"></Spinner>
<EditText android:layout_height="wrap_content" android:inputType="text|textPersonName" android:layout_width="wrap_content" android:layout_below="#+id/searchRsult_spinner" android:layout_alignParentLeft="true" android:layout_marginTop="16dp" android:layout_alignParentRight="true" android:id="#+id/searchResult_txtRollNumber">
<requestFocus></requestFocus>
</EditText>
<Button android:layout_height="wrap_content" android:text="Show result" android:id="#+id/button1" android:layout_below="#+id/searchResult_txtRollNumber" android:layout_alignParentLeft="true" android:layout_marginTop="33dp" android:layout_width="200dp" android:textColor="#color/myColorBlue"></Button>
<Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Cancel" android:id="#+id/button2" android:layout_alignBaseline="#+id/button1" android:layout_alignBottom="#+id/button1" android:layout_toRightOf="#+id/button1" android:layout_alignParentRight="true" android:textColor="#color/myColorBlue"></Button>
</RelativeLayout>
</ScrollView>
Try this :
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.80"
android:background="#drawable/questionggreen"
android:orientation="vertical"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"
android:clipToPadding="true"
android:orientation="vertical" >
<RadioButton
android:id="#+id/radio0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 24 Juin 1944"
android:textColor="#ff00ff"
android:textSize="19dp"
android:textStyle="bold" />
<RadioButton
android:id="#+id/radio2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 9 Decembre 1988"
android:textColor="#ff00ff"
android:textSize="19dp"
android:textStyle="bold" />
<RadioButton
android:id="#+id/radio1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="14 octobre 1978"
android:textColor="#ff00ff"
android:textSize="19dp"
android:textStyle="bold" />
<TextView
android:id="#+id/Chrono"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000000"
android:textStyle="bold" android:layout_marginTop="2dp"/>
</RadioGroup>
<TextView
android:id="#+id/Lareponseetait"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true" />
<TextView
android:id="#+id/QuestionNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_weight="1.26"
android:text="Question 1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#00ff00"
android:textStyle="normal|bold" />
<TextView
android:id="#+id/Question"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/QuestionNumber"
android:layout_marginTop="30dp"
android:text="Quelle est la date de naissance de Usher ?"
android:textColor="#FFFACD"
android:textSize="16dp"
android:textStyle="normal|bold"
android:typeface="sans" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="158dp"
android:layout_height="154dp"
android:layout_below="#id/Question"
android:layout_centerHorizontal="true"
android:layout_marginTop="32dp"
android:src="#drawable/mzl"
android:visibility="gone" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_weight="1.26"
android:text="CELB"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/Goodanswercount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/Goodanswercount"
android:layout_alignLeft="#+id/radioGroup1"
android:layout_alignParentRight="true"
android:layout_below="#+id/radioGroup1"
android:layout_marginTop="3dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#00ff00"
android:textStyle="bold" android:layout_toRightOf="#id/textView1"/>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignTop="#+id/Goodanswercount"
android:text="Correct :"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#00ff00" android:layout_marginTop="3dp"/>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/Goodanswercount"
android:text="Wrong :"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff0000" android:layout_toLeftOf="#+id/Goodanswercount"/>
<TextView
android:id="#+id/Wronganswercount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/textView2"
android:layout_toRightOf="#+id/textView2"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#ff0000"
android:textStyle="bold" />
<TextView
android:id="#+id/Lareponseetait"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/QuestionNumber"
android:text="La reponse etait :"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff0000" android:layout_marginTop="5dp"/>
<TextView
android:id="#+id/Lareponsecorrectetait"
android:layout_width="215dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/Lareponseetait"
android:layout_alignBottom="#+id/Lareponseetait"
android:layout_alignParentRight="true"
android:text="Small Text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff0000" />
<TextView
android:id="#+id/Scores1"
android:layout_width="29dp"
android:layout_height="wrap_content"
android:layout_above="#+id/Question"
android:layout_alignParentRight="true"
android:text="000"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff00ff"
android:textStyle="bold" />
<TextView
android:id="#+id/Scores"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/Question"
android:layout_toLeftOf="#+id/Scores1"
android:text="Scores : 00"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff00ff"
android:textStyle="bold" />
<ImageButton
android:id="#+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView2"
android:layout_centerHorizontal="true"
android:src="#drawable/buttonok" android:layout_marginTop="10dp"/>
<CheckBox
android:id="#+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/imageButton1"
android:text="Sounds Off" android:layout_marginTop="3dp"/>
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/checkBox1"
android:layout_alignBottom="#+id/checkBox1"
android:layout_alignParentLeft="true"
android:text="Quit" />
</RelativeLayout>
</ScrollView>

Categories

Resources