I am using header and footer and also use scroll view in within content part only.
if i run that application in emulator it display header and content part only. Footer view is missing in my application.
Here my code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:id="#+id/rl_header"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#drawable/head" >
<TextView android:id="#+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="#string/gebrauchte"
android:textColor="#fff"
android:textStyle="bold"
android:textSize="20dp"/> </RelativeLayout>
<ScrollView
android:id="#+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rl_header"
>
<RelativeLayout
android:id="#+id/ll_bikeDetail"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#fff" >
<RelativeLayout
android:id="#+id/rl_bikeDetail"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#fff" >
<TextView
android:id="#+id/txtDetail"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginLeft="8dp"
android:text="#string/detail"
android:textColor="#000"
android:textSize="15dp"
android:textStyle="bold" android:layout_marginTop="5dp"/>
<TextView
android:id="#+id/txtDetail1"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginLeft="130dp"
android:text="#string/pass"
android:textColor="#000"
android:textSize="13dp" android:layout_marginTop="5dp"/>
<TextView
android:id="#+id/txtDynamic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="267dp"
android:text="2175"
android:textStyle="bold" android:layout_marginTop="5dp"/>
<View
android:id="#+id/img_hrDetail"
android:layout_width="wrap_content"
android:layout_height="2dp"
android:layout_below="#+id/txtDetail"
android:background="#FF909090" />
<TextView
android:id="#+id/txtBikeType"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/img_hrDetail"
android:layout_marginLeft="8dp"
android:text="#string/biketype"
android:textColor="#000"
android:textSize="15dp"
android:textStyle="bold" android:layout_marginTop="5dp"/>
<TextView
android:id="#+id/txtBike"
android:layout_width="wrap_content"
android:layout_height="23dp"
android:layout_below="#+id/img_hrDetail"
android:layout_marginLeft="110dp"
android:text="#string/belie"
android:textColor="#ff0000"
android:textSize="15dp" android:layout_marginTop="5dp"/>
<Button
android:id="#+id/btn_arwBikeType"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/img_hrDetail"
android:layout_marginLeft="280dp"
android:background="#drawable/arrow" android:layout_marginTop="5dp"/>
<View
android:id="#+id/img_hrBikeType"
android:layout_width="wrap_content"
android:layout_height="2dp"
android:layout_below="#+id/txtBikeType"
android:background="#FF909090" />
<TextView
android:id="#+id/txtMarke"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/img_hrBikeType"
android:layout_marginLeft="8dp"
android:text="#string/mark"
android:textColor="#000"
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtMarkeBe"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/img_hrBikeType"
android:layout_marginLeft="110dp"
android:text="#string/belie"
android:textColor="#ff0000"
android:textSize="15dp" />
<Button
android:id="#+id/btn_arwBrand"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/img_hrBikeType"
android:layout_marginLeft="280dp"
android:background="#drawable/arrow" />
<TextView
android:id="#+id/txtModel"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/txtMarke"
android:layout_marginLeft="8dp"
android:text="#string/model"
android:textColor="#000"
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtModelBe"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/txtMarke"
android:layout_marginLeft="110dp"
android:text="#string/belie"
android:textColor="#ff0000"
android:textSize="15dp" />
<Button
android:id="#+id/btn_arwModel"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/txtMarke"
android:layout_marginLeft="280dp"
android:background="#drawable/arrow" />
<View
android:id="#+id/img_hrModel"
android:layout_width="wrap_content"
android:layout_height="2dp"
android:layout_below="#+id/txtModel"
android:background="#FF909090" />
<TextView
android:id="#+id/txtErst"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/img_hrModel"
android:layout_marginLeft="8dp"
android:text="#string/erst"
android:textColor="#000"
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtErstBe"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/img_hrModel"
android:layout_marginLeft="115dp"
android:layout_marginTop="3dp"
android:text="#string/belie"
android:textColor="#ff0000"
android:textSize="13dp" />
<Button
android:id="#+id/btn_arwErstBe"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/img_hrModel"
android:layout_marginLeft="170dp"
android:background="#drawable/arrow"/>
<TextView
android:id="#+id/txtErstBis"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/img_hrModel"
android:layout_marginLeft="200dp"
android:layout_marginTop="5dp"
android:text="#string/bis"
android:textColor="#000"
android:textSize="13dp" />
<TextView
android:id="#+id/txtErstBel"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/img_hrModel"
android:layout_marginLeft="220dp"
android:layout_marginTop="5dp"
android:text="#string/belie"
android:textColor="#ff0000"
android:textSize="13dp" />
<Button
android:id="#+id/btn_arwErst"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/img_hrModel"
android:layout_marginLeft="280dp"
android:background="#drawable/arrow" />
<TextView
android:id="#+id/txtLauf"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/txtErst"
android:layout_marginLeft="8dp"
android:text="#string/lauf"
android:textColor="#000"
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtLaufKm"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/txtErst"
android:layout_marginLeft="115dp"
android:layout_marginTop="3dp"
android:text="#string/km"
android:textColor="#ff0000"
android:textSize="13dp" />
<Button
android:id="#+id/btn_arwLaufBe"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/txtErst"
android:layout_marginLeft="170dp"
android:background="#drawable/arrow" />
<TextView
android:id="#+id/txtLaufBis"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/txtErst"
android:layout_marginLeft="200dp"
android:layout_marginTop="3dp"
android:text="#string/bis"
android:textColor="#000"
android:textSize="13dp" />
<TextView
android:id="#+id/txtLaufBel"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/txtErst"
android:layout_marginLeft="220dp"
android:layout_marginTop="3dp"
android:text="#string/belie"
android:textColor="#ff0000"
android:textSize="13dp" />
<Button
android:id="#+id/btn_arwLauf"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/txtErst"
android:layout_marginLeft="280dp"
android:background="#drawable/arrow" />
<TextView
android:id="#+id/txtHub"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/txtLauf"
android:layout_marginLeft="8dp"
android:text="#string/hub"
android:textColor="#000"
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtHubCcm"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/txtLauf"
android:layout_marginLeft="115dp"
android:layout_marginTop="3dp"
android:text="#string/ccm"
android:textColor="#ff0000"
android:textSize="13dp" />
<Button
android:id="#+id/btn_arwHubCcm"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/txtLauf"
android:layout_marginLeft="170dp"
android:background="#drawable/arrow" />
<TextView
android:id="#+id/txtHubBis"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/txtLauf"
android:layout_marginLeft="200dp"
android:layout_marginTop="3dp"
android:text="#string/bis"
android:textColor="#000"
android:textSize="13dp" />
<TextView
android:id="#+id/txtHubBel"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/txtLauf"
android:layout_marginLeft="220dp"
android:layout_marginTop="3dp"
android:text="#string/belie"
android:textColor="#ff0000"
android:textSize="13dp" />
<Button
android:id="#+id/btn_arwHub"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/txtLauf"
android:layout_marginLeft="280dp"
android:background="#drawable/arrow" />
<TextView
android:id="#+id/txtPre"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/txtHub"
android:layout_marginLeft="8dp"
android:text="#string/pre"
android:textColor="#000"
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtPreBe"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/txtHub"
android:layout_marginLeft="115dp"
android:layout_marginTop="3dp"
android:text="#string/sign"
android:textColor="#ff0000"
android:textSize="13dp" />
<Button
android:id="#+id/btn_arwPreBe"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/txtHub"
android:layout_marginLeft="170dp"
android:background="#drawable/arrow" />
<TextView
android:id="#+id/txtPreBis"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/txtHub"
android:layout_marginLeft="200dp"
android:layout_marginTop="3dp"
android:text="#string/bis"
android:textColor="#000"
android:textSize="13dp" />
<TextView
android:id="#+id/txtPreBel"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/txtHub"
android:layout_marginLeft="220dp"
android:layout_marginTop="3dp"
android:text="#string/belie"
android:textColor="#ff0000"
android:textSize="13dp" />
<Button
android:id="#+id/btn_arwPre"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/txtHub"
android:layout_marginLeft="280dp"
android:background="#drawable/arrow" />
<View
android:id="#+id/img_hrPre"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_below="#+id/txtPre"
android:background="#FF909090" />
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/txtDynamic"
android:layout_alignLeft="#+id/btn_arwBikeType"
android:background="#000" android:layout_marginTop="5dp"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_Wo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rl_bikeDetail"
android:background="#fff" >
<TextView
android:id="#+id/txtWo"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/imgHrule3"
android:layout_marginLeft="8dp"
android:text="#string/wo"
android:textColor="#000"
android:textSize="15dp"
android:textStyle="bold"
android:layout_marginTop="5dp"/>
<com.InternetGMBH.ThousandPS.Utilities.SegmentedRadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" android:layout_below="#+id/img_hrPre"
android:layout_marginLeft="100dp"
android:layout_marginRight="15dp" android:id="#+id/segment_text"
android:checkedButton="#+id/btn_egal"> <RadioButton
android:id="#id/btn_egal" android:minWidth="60dip"
android:minHeight="33dip" android:text="Egal"
android:textAppearance="?android:attr/textAppearanceSmall"
android:button="#null" android:gravity="center"
android:textColor="#color/radio_colors" /> <RadioButton
android:id="#+id/btn_gps" android:minWidth="60dip"
android:minHeight="33dip" android:text="Gps"
android:button="#null" android:gravity="center"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/radio_colors" /> <RadioButton
android:id="#+id/btn_eingabe" android:minWidth="60dip"
android:minHeight="33dip" android:text="Eingabe"
android:button="#null" android:gravity="center"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/radio_colors" />
</com.InternetGMBH.ThousandPS.Utilities.SegmentedRadioGroup>
<!-- <Button
android:id="#+id/btn_egal"
android:layout_width="70dp"
android:layout_height="35dp"
android:layout_below="#+id/img_hrPre"
android:layout_marginLeft="100dp"
android:layout_marginRight="15dp"
android:text="Egal" android:layout_marginTop="5dp" android:background="#drawable/new_01" android:textColor="#fff"/>
-->
<TextView
android:id="#+id/txtland"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/txtWo"
android:layout_marginLeft="8dp"
android:layout_marginTop="5dp"
android:text="#string/land"
android:textColor="#000"
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txtGpsStatus"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/txtWo"
android:textStyle="bold"
android:layout_marginTop="3dp"
android:text=""
android:textColor="#000"
android:textSize="15dp"
android:layout_marginLeft="8dp"/>
<TextView
android:id="#+id/txtlandBe"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/txtWo"
android:layout_marginLeft="110dp"
android:layout_marginTop="8dp"
android:text="#string/belie"
android:textColor="#ff0000"
android:textSize="13dp" />
<TextView
android:id="#+id/txtGpsValue"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#id/txtWo"
android:layout_marginLeft="110dp"
android:layout_marginTop="3dp"
android:text=""
android:textColor="#ff0000"
android:textSize="13dp" />
<Button
android:id="#+id/btn_arwLand"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/txtWo"
android:layout_marginLeft="180dp"
android:background="#drawable/arrow" android:layout_marginTop="5dp"/>
<EditText
android:id="#+id/txt_plz"
android:layout_width="50dp"
android:layout_height="30dp"
android:layout_below="#+id/txtWo"
android:layout_marginLeft="230dp"
android:layout_marginRight="15dp"
android:textSize="10dp" android:layout_marginTop="5dp"/>
<TextView
android:id="#+id/txtmax"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/txtland"
android:layout_marginLeft="8dp"
android:layout_marginTop="3dp"
android:text="#string/max"
android:textColor="#000"
android:textSize="10dp" />
<TextView
android:id="#+id/txtmaxKm"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_below="#+id/txtland"
android:layout_marginLeft="110dp"
android:layout_marginTop="3dp"
android:text="200 km"
android:textColor="#ff0000"
android:textSize="13dp" />
<SeekBar
android:id="#+id/seekBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/btn_arwLand"
android:layout_alignRight="#+id/txt_plz"
android:layout_below="#+id/txtlandBe"
android:max="490" />
</RelativeLayout> </RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/rl_footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/scrollView"
android:background="#fff" >
<Button
android:id="#+id/btn_resetForm"
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/rl_Wo"
android:layout_marginLeft="14dp"
android:layout_marginTop="20dp"
android:background="#drawable/resetform" />
<Button
android:id="#+id/btn_anze"
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_below="#+id/rl_Wo"
android:layout_marginLeft="56dp"
android:layout_marginTop="20dp"
android:layout_toRightOf="#+id/btn_resetForm"
android:background="#drawable/redbutton"
android:text="Anzeigen"
android:textColor="#fff" /> </RelativeLayout>
</RelativeLayout>
any one can help me what's the issue here?
Here my answer,
in footer relative layout just add android:layout_alignParentBottom="true"
<RelativeLayout
android:id="#+id/rl_footer"
android:layout_width="fill_parent"
android:layout_height="46dp"
android:layout_alignParentBottom="true"
android:background="#fff" >
<Button....../>
<Button...../>
</RelativeLayout>
Related
I was trying to find a way to scroll my Relative Layout while I'm in designer in Intellij, since I can't see all the elements I want and position them right. I researched and read numerous threads and the advice I saw most was "wrap the layout you want to scroll in ScrollView", which I did, but that didn't help me. I still can't see all of my widgets and when I put them near the end of the screen, they either shrink or get positioned below - where I can't see them and manage them. I'm new to all this, so I guess I must be doing something wrong.
I apologize in advance if the answer to this question already exists, I couldn't find it
Here's my XML :
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/ScrollView02"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:nestedScrollingEnabled="true"
android:scrollIndicators="right"
tools:scrollY="150px" android:addStatesFromChildren="true" android:isScrollContainer="true"
android:scrollbarAlwaysDrawHorizontalTrack="false" android:scrollY="300dp">
<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="wrap_content"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/imageButton3"
android:layout_alignParentTop="true" android:layout_alignParentStart="false"
android:layout_alignParentEnd="true" android:background="#drawable/abc_ic_menu_overflow_material"
android:clickable="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TITLE"
android:id="#+id/textView7" android:layout_below="#+id/imageButton3"
android:layout_centerHorizontal="true" android:textSize="25dp" android:textStyle="bold"/>
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/spinner"
android:layout_marginLeft="20dp" android:layout_marginRight="20dp"
android:layout_above="#+id/textView9" android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"/>
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/seekBar"
android:layout_alignBottom="#+id/weight_button" android:layout_toEndOf="#+id/weight_button"
android:layout_marginBottom="12dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="First"
android:id="#+id/textView9"
android:layout_above="#+id/textView10" android:layout_alignStart="#+id/spinner"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="< >"
android:id="#+id/textView10"
android:textStyle="bold"
android:textSize="20dp"
android:layout_above="#+id/seekBar" android:layout_toStartOf="#+id/imageButton3"/>
<Button
android:layout_width="50dp"
android:layout_height="50dp"
android:id="#+id/weight_button"
android:text="80"
android:allowUndo="true"
android:background="#drawable/round_button_weight"
android:layout_marginLeft="5dp" android:textColor="#android:color/white"
android:layout_above="#+id/textView11" android:layout_alignStart="#+id/textView9"
android:layout_marginBottom="17dp"/>
<LinearLayout android:orientation="horizontal" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/weight_button"
android:layout_alignEnd="#+id/imageButton3" android:id="#+id/linearLayout2"
android:layout_marginTop="10dp" android:layout_alignLeft="#+id/weight_button">
</LinearLayout>
<TextView android:layout_width="match_parent" android:layout_height="1dp" android:id="#+id/textView11"
android:background="#555252" android:layout_weight="1" android:layout_gravity="center_vertical"
android:layout_alignParentStart="true" android:layout_marginBottom="10dp"
android:layout_above="#+id/textView12"/>
<SeekBar android:layout_width="match_parent" android:layout_height="wrap_content" android:id="#+id/seekBar2"
android:layout_centerVertical="true" android:layout_toEndOf="#+id/button"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Second"
android:id="#+id/textView12"
android:layout_above="#+id/button" android:layout_alignStart="#+id/textView9"
android:layout_marginBottom="5dp" android:layout_marginTop="10dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="< >"
android:id="#+id/textView13" android:textStyle="bold" android:textSize="20dp"
android:layout_below="#+id/textView12" android:layout_alignEnd="#+id/spinner"/>
<Button android:layout_width="50dp" android:layout_height="50dp" android:id="#+id/button" android:text="175"
android:allowUndo="true" android:background="#drawable/round_button_height"
android:textColor="#android:color/white"
android:layout_centerVertical="true" android:layout_toStartOf="#+id/seekBar"/>
<TextView android:layout_width="match_parent" android:layout_height="1dp" android:id="#+id/textView14"
android:background="#555252" android:layout_weight="1" android:layout_gravity="center_vertical"
android:layout_below="#+id/button" android:layout_alignLeft="#+id/textView11"
android:layout_marginTop="10dp" android:layout_marginBottom="5dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Third"
android:id="#+id/textView15"
android:layout_below="#+id/textView14" android:layout_alignStart="#+id/button2"
android:layout_marginBottom="5dp" android:layout_marginTop="10dp"/>
<Button android:layout_width="50dp" android:layout_height="50dp" android:id="#+id/button2" android:text="24"
android:allowUndo="true" android:background="#drawable/round_button_height"
android:textColor="#android:color/white"
android:layout_alignTop="#+id/textView16" android:layout_toStartOf="#+id/seekBar3"
android:layout_marginBottom="20dp"/>
<SeekBar android:layout_width="match_parent" android:layout_height="wrap_content" android:id="#+id/seekBar3"
android:layout_alignBottom="#+id/button2" android:layout_alignStart="#+id/seekBar2"
android:layout_marginBottom="12dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="< >"
android:id="#+id/textView16" android:textStyle="bold" android:textSize="20dp"
android:layout_below="#+id/textView15"
android:layout_alignRight="#+id/textView10" android:layout_alignLeft="#+id/textView10"/>
<TextView android:layout_width="match_parent" android:layout_height="1dp" android:id="#+id/textView17"
android:background="#555252" android:layout_weight="1" android:layout_gravity="center_vertical"
android:layout_below="#+id/button2"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0-6"
android:id="#+id/radioButton1"
android:layout_marginTop="37dp" android:checked="false"
android:layout_below="#+id/textView17" android:layout_alignEnd="#+id/textView9"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6-18"
android:id="#+id/radioButton2"
android:checked="false"
android:layout_alignTop="#+id/radioButton3" android:layout_centerHorizontal="true"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=">18"
android:id="#+id/radioButton3"
android:checked="false"
android:layout_alignTop="#+id/radioButton1" android:layout_alignEnd="#+id/textView16"
android:layout_marginEnd="26dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Title1"
android:id="#+id/textView18"
android:textStyle="bold"
android:textSize="15dp" android:layout_above="#+id/radioButton2" android:layout_alignParentStart="false"
android:padding="10dp" android:textAllCaps="true" android:textColor="#android:color/white"
android:background="#3b3c50" android:layout_marginTop="20dp" android:layout_marginBottom="10dp"/>
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:text="Title2" android:id="#+id/textView19"
android:textStyle="bold"
android:textSize="15dp" android:layout_below="#+id/radioButton1"
android:layout_alignStart="#+id/textView18" android:layout_marginTop="10dp"
android:layout_marginBottom="10dp" android:padding="10dp" android:textAllCaps="true"
android:textColor="#android:color/white" android:background="#3b3c50"/>
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1"
android:id="#+id/radioButton" android:checked="false"
android:layout_below="#+id/textView19" android:layout_alignStart="#+id/radioButton1"/>
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2"
android:id="#+id/radioButton4" android:checked="false"
android:layout_below="#+id/textView19" android:layout_alignEnd="#+id/textView7"/>
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="3"
android:id="#+id/radioButton5" android:checked="false"
android:layout_alignTop="#+id/radioButton4" android:layout_alignEnd="#+id/textView13"/>
<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Title 3"
android:id="#+id/textView20" android:textStyle="bold" android:textSize="15dp"
android:layout_below="#+id/radioButton" android:layout_alignStart="#+id/textView19"
android:layout_marginTop="10dp" android:layout_marginBottom="10dp"
android:textColor="#android:color/white" android:background="#3b3c50" android:textAllCaps="true"
android:padding="10dp"/>
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1"
android:id="#+id/radioButton6" android:checked="false"
android:layout_below="#+id/textView20" android:layout_alignStart="#+id/radioButton"/>
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2"
android:id="#+id/radioButton7" android:checked="false"
android:layout_alignTop="#+id/radioButton6" android:layout_alignStart="#+id/radioButton4"/>
<RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="3"
android:id="#+id/radioButton8" android:checked="false"
android:layout_alignTop="#+id/radioButton7" android:layout_alignStart="#+id/radioButton5"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Title4"
android:id="#+id/textView21" android:textStyle="bold" android:textSize="15dp"
android:layout_below="#+id/radioButton8" android:layout_alignStart="#+id/textView20"
android:layout_marginTop="10dp" android:layout_marginBottom="10dp"/>
</RelativeLayout>
</ScrollView>
You can add LinearLayout under ScrollView and then put RelativeLayout under LinearLayout.
Try this i have edited your layout file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/ScrollView02"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:addStatesFromChildren="true"
android:fillViewport="true"
android:isScrollContainer="true"
android:nestedScrollingEnabled="true"
android:scrollIndicators="right"
android:scrollbarAlwaysDrawHorizontalTrack="false"
tools:scrollY="150px">
<RelativeLayout
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">
<ImageButton
android:id="#+id/imageButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:background="#drawable/abc_ic_menu_overflow_material"
android:clickable="true" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageButton3"
android:layout_centerHorizontal="true"
android:text="TITLE"
android:textSize="25dp"
android:textStyle="bold" />
<Spinner
android:id="#+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView9"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" />
<SeekBar
android:id="#+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/weight_button"
android:layout_marginBottom="12dp"
android:layout_toRightOf="#+id/weight_button"
android:layout_toEndOf="#+id/weight_button" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/textView10"
android:layout_alignLeft="#+id/spinner"
android:layout_alignStart="#+id/spinner"
android:text="First" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/seekBar"
android:layout_toLeftOf="#+id/imageButton3"
android:layout_toStartOf="#+id/imageButton3"
android:text="< >"
android:textSize="20dp"
android:textStyle="bold" />
<Button
android:id="#+id/weight_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_above="#+id/textView11"
android:layout_alignLeft="#+id/textView9"
android:layout_alignStart="#+id/textView9"
android:layout_marginBottom="17dp"
android:layout_marginLeft="5dp"
android:allowUndo="true"
android:background="#drawable/round_button_weight"
android:text="80"
android:textColor="#android:color/white" />
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/imageButton3"
android:layout_alignRight="#+id/imageButton3"
android:layout_alignLeft="#+id/weight_button"
android:layout_below="#+id/weight_button"
android:layout_marginTop="10dp"
android:orientation="horizontal"></LinearLayout>
<TextView
android:id="#+id/textView11"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_above="#+id/textView12"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_gravity="center_vertical"
android:layout_marginBottom="10dp"
android:layout_weight="1"
android:background="#555252" />
<SeekBar
android:id="#+id/seekBar2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="#+id/button"
android:layout_toRightOf="#+id/button" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/button"
android:layout_alignStart="#+id/textView9"
android:layout_alignLeft="#+id/textView9"
android:layout_marginBottom="5dp"
android:layout_marginTop="10dp"
android:text="Second" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner"
android:layout_alignRight="#+id/spinner"
android:layout_below="#+id/textView12"
android:text="< >"
android:textSize="20dp"
android:textStyle="bold" />
<Button
android:id="#+id/button"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:layout_toStartOf="#+id/seekBar"
android:layout_toLeftOf="#+id/seekBar"
android:allowUndo="true"
android:background="#drawable/round_button_height"
android:text="175"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/textView14"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignLeft="#+id/textView11"
android:layout_below="#+id/button"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#555252" />
<TextView
android:id="#+id/textView15"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/button2"
android:layout_alignLeft="#+id/button2"
android:layout_below="#+id/textView14"
android:layout_marginBottom="5dp"
android:layout_marginTop="10dp"
android:text="Third" />
<Button
android:id="#+id/button2"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignTop="#+id/textView16"
android:layout_marginBottom="20dp"
android:layout_toStartOf="#+id/seekBar3"
android:layout_toLeftOf="#+id/seekBar3"
android:allowUndo="true"
android:background="#drawable/round_button_height"
android:text="24"
android:textColor="#android:color/white" />
<SeekBar
android:id="#+id/seekBar3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/button2"
android:layout_alignStart="#+id/seekBar2"
android:layout_alignLeft="#+id/seekBar2"
android:layout_marginBottom="12dp" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView10"
android:layout_alignRight="#+id/textView10"
android:layout_below="#+id/textView15"
android:text="< >"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView17"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/button2"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="#555252" />
<RadioButton
android:id="#+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView9"
android:layout_alignRight="#+id/textView9"
android:layout_below="#+id/textView17"
android:layout_marginTop="37dp"
android:checked="false"
android:text="0-6" />
<RadioButton
android:id="#+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/radioButton3"
android:layout_centerHorizontal="true"
android:checked="false"
android:text="6-18" />
<RadioButton
android:id="#+id/radioButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView16"
android:layout_alignRight="#+id/textView16"
android:layout_alignTop="#+id/radioButton1"
android:layout_marginEnd="26dp"
android:layout_marginRight="26dp"
android:checked="false"
android:text=">18" />
<TextView
android:id="#+id/textView18"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/radioButton2"
android:layout_alignParentStart="false"
android:layout_alignParentLeft="false"
android:layout_marginBottom="10dp"
android:layout_marginTop="20dp"
android:background="#3b3c50"
android:padding="10dp"
android:text="Title1"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="15dp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView19"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/textView18"
android:layout_alignLeft="#+id/textView18"
android:layout_below="#+id/radioButton1"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="#3b3c50"
android:padding="10dp"
android:text="Title2"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="15dp"
android:textStyle="bold" />
<RadioButton
android:id="#+id/radioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/radioButton1"
android:layout_alignLeft="#+id/radioButton1"
android:layout_below="#+id/textView19"
android:checked="false"
android:text="1" />
<RadioButton
android:id="#+id/radioButton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView7"
android:layout_alignRight="#+id/textView7"
android:layout_below="#+id/textView19"
android:checked="false"
android:text="2" />
<RadioButton
android:id="#+id/radioButton5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/textView13"
android:layout_alignRight="#+id/textView13"
android:layout_alignTop="#+id/radioButton4"
android:checked="false"
android:text="3" />
<TextView
android:id="#+id/textView20"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/textView19"
android:layout_alignLeft="#+id/textView19"
android:layout_below="#+id/radioButton"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="#3b3c50"
android:padding="10dp"
android:text="Title 3"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="15dp"
android:textStyle="bold" />
<RadioButton
android:id="#+id/radioButton6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/radioButton"
android:layout_alignLeft="#+id/radioButton"
android:layout_below="#+id/textView20"
android:checked="false"
android:text="1" />
<RadioButton
android:id="#+id/radioButton7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/radioButton4"
android:layout_alignLeft="#+id/radioButton4"
android:layout_alignTop="#+id/radioButton6"
android:checked="false"
android:text="2" />
<RadioButton
android:id="#+id/radioButton8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/radioButton5"
android:layout_alignLeft="#+id/radioButton5"
android:layout_alignTop="#+id/radioButton7"
android:checked="false"
android:text="3" />
<TextView
android:id="#+id/textView21"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/textView20"
android:layout_alignLeft="#+id/textView20"
android:layout_below="#+id/radioButton8"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:text="Title4"
android:textSize="15dp"
android:textStyle="bold" />
</RelativeLayout>
Thank you for your suggestions, but neither of them did help. After I updated IntelliJ to 3.x version, it worked, without changing the code.
I have RelativeLayout inside a scrolbar,as you see the height of relative layout doesn't fill the scrollbar height
how can I solve it?
I have another question, when I focus in an edittext the whole layut (parent layouyt) push up,I want just my layout put inside the scroll bar pushes up
<ScrollView
android:id="#+id/scrollView_main"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_below="#+id/image_Dead_Load"
android:layout_marginBottom="2dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:fadeScrollbars="false"
android:verticalScrollbarPosition="left">
<RelativeLayout
android:id="#+id/data_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/image_Dead_Load"
android:layout_centerHorizontal="true"
android:background="#drawable/layout_border">
<RelativeLayout
android:id="#+id/material_info"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/title_border">
<TextView
android:id="#+id/wall_material"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/material_thickness"
android:layout_gravity="center_horizontal"
android:layout_marginEnd="91dp"
android:layout_marginRight="110dp"
android:paddingLeft="5sp"
android:text="جنس مصالح"
android:textColor="#color/black"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:id="#+id/material_thickness"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="3dp"
android:paddingLeft="5sp"
android:text="ضخامت mm"
android:textColor="#color/black"
android:textSize="15sp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/brick_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/material_info"
android:layout_marginTop="5dp"
android:paddingLeft="6dp"
android:paddingRight="6dp">
<EditText
android:id="#+id/editText_wall_width"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_alignBottom="#+id/wall_material_spinner"
android:layout_alignTop="#+id/wall_material_spinner"
android:layout_marginRight="3dp"
android:background="#drawable/textinputborder"
android:inputType="numberDecimal"
android:paddingLeft="5sp"
android:textColor="#color/black" />
<Spinner
android:id="#+id/wall_material_spinner"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_toLeftOf="#+id/brick_material"
android:layout_toRightOf="#+id/editText_wall_width"
android:layout_toStartOf="#+id/brick_material"
android:background="#drawable/spinner_background"
android:spinnerMode="dropdown" />
<TextView
android:id="#+id/brick_material"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/wall_material_spinner"
android:layout_alignParentRight="true"
android:text="نوع آجر"
android:textColor="#color/gray_heavy"
android:textSize="15sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/plastering_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/brick_layout"
android:paddingLeft="6dp"
android:paddingRight="6dp">
<EditText
android:id="#+id/editText_plastering_material"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_alignBottom="#+id/plastering_material_spinner"
android:layout_alignTop="#+id/plastering_material_spinner"
android:layout_marginRight="3dp"
android:background="#drawable/textinputborder"
android:inputType="numberDecimal"
android:paddingLeft="5sp"
android:textColor="#color/black" />
<Spinner
android:id="#+id/plastering_material_spinner"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginTop="7dp"
android:layout_toLeftOf="#+id/plastering_material"
android:layout_toRightOf="#+id/editText_plastering_material"
android:layout_toStartOf="#+id/plastering_material"
android:background="#drawable/spinner_background"
android:gravity="center_vertical"
android:spinnerMode="dropdown" />
<TextView
android:id="#+id/plastering_material"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/plastering_material_spinner"
android:layout_alignParentRight="true"
android:text="نوع اندود"
android:textColor="#color/gray_heavy"
android:textSize="15sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/esther_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/plastering_layout"
android:paddingLeft="6dp"
android:paddingRight="6dp">
<TextView
android:id="#+id/esther_material"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/esther_material_spinner"
android:layout_alignParentRight="true"
android:text="نوع آستر"
android:textColor="#color/gray_heavy"
android:textSize="15sp" />
<Spinner
android:id="#+id/esther_material_spinner"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginTop="7dp"
android:layout_toLeftOf="#+id/esther_material"
android:layout_toRightOf="#+id/editText_esther_material"
android:layout_toStartOf="#+id/esther_material"
android:background="#drawable/spinner_background"
android:gravity="center_vertical"
android:spinnerMode="dropdown" />
<EditText
android:id="#+id/editText_esther_material"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_alignBottom="#+id/esther_material_spinner"
android:layout_alignTop="#+id/esther_material_spinner"
android:layout_marginRight="3dp"
android:background="#drawable/textinputborder"
android:inputType="numberDecimal"
android:paddingLeft="5sp"
android:textColor="#color/black" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/exterior_mortar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/esther_layout"
android:paddingLeft="6dp"
android:paddingRight="6dp">
<TextView
android:id="#+id/exterior_mortar_material"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/exterior_mortar_material_spinner"
android:layout_alignParentRight="true"
android:text="ملات بیرونی"
android:textColor="#color/gray_heavy"
android:textSize="12sp" />
<Spinner
android:id="#+id/exterior_mortar_material_spinner"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginTop="7dp"
android:layout_toEndOf="#+id/editText_exterior_mortar_material"
android:layout_toLeftOf="#+id/exterior_mortar_material"
android:layout_toRightOf="#+id/editText_exterior_mortar_material"
android:background="#drawable/spinner_background"
android:gravity="center_vertical"
android:spinnerMode="dropdown" />
<EditText
android:id="#+id/editText_exterior_mortar_material"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_alignBottom="#+id/exterior_mortar_material_spinner"
android:layout_alignTop="#+id/exterior_mortar_material_spinner"
android:layout_marginRight="3dp"
android:background="#drawable/textinputborder"
android:inputType="numberDecimal"
android:paddingLeft="5sp"
android:textColor="#color/black" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/facing_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/exterior_mortar_layout"
android:paddingLeft="6dp"
android:paddingRight="6dp">
<TextView
android:id="#+id/facing_material"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/facing_material_spinner"
android:layout_alignParentRight="true"
android:text="نوع نما"
android:textColor="#color/gray_heavy"
android:textSize="15sp" />
<Spinner
android:id="#+id/facing_material_spinner"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginTop="7dp"
android:layout_toEndOf="#+id/editText_facing_material"
android:layout_toLeftOf="#+id/facing_material"
android:layout_toRightOf="#+id/editText_facing_material"
android:background="#drawable/spinner_background"
android:gravity="center_vertical"
android:spinnerMode="dropdown" />
<EditText
android:id="#+id/editText_facing_material"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_alignBottom="#+id/facing_material_spinner"
android:layout_alignTop="#+id/facing_material_spinner"
android:layout_marginRight="3dp"
android:background="#drawable/textinputborder"
android:inputType="numberDecimal"
android:paddingLeft="5sp"
android:textColor="#color/black" />
</RelativeLayout>
<Button
android:id="#+id/wall_loading_btn"
android:layout_width="150dp"
android:layout_height="36dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="6dp"
android:layout_marginTop="6dp"
android:background="#drawable/buttonshape"
android:gravity="center"
android:onClick="wallLoading"
android:text="محاسبه"
android:textColor="#color/white"
android:textSize="18sp"
android:textStyle="bold"></Button>
<TextView
android:id="#+id/loading_conclusion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/wall_loading_btn"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignTop="#+id/wall_loading_btn"
android:layout_gravity="center_horizontal"
android:layout_toLeftOf="#+id/wall_loading_btn"
android:gravity="center_horizontal|center_vertical"
android:text="جنس مصالح"
android:textColor="#color/black"
android:textSize="15sp" />
</RelativeLayout>
</ScrollView>
I am working on my first app and have it working pretty much as I would like with one small exception. The problem is in the scrollview with a relative layout that contains up to 20 buttons. When I scroll down and click on a button near the bottom the scrollview it scrolls back to the top after the click. I want the scrollview to stay where it is after a click. For example after clicking button 18 I don't want the user to have to scroll back down to the bottom to click button 19. Can someone tell me how to stop the scrollview from automatically scrolling to the top after a click.
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/timerScrollView"
android:layout_below="#+id/startStopBtn"
android:layout_alignParentEnd="true"
android:layout_marginTop="10dp" >
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
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" >
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner1Btn"
android:layout_marginTop="5dp"
android:layout_below="#+id/startStopBtn"
android:layout_alignParentStart="true"
android:layout_marginLeft="0dp"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:visibility="gone" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner1TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner1Btn"
android:visibility="gone"
android:layout_alignParentEnd="true" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner2Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:isScrollContainer="true"
android:keepScreenOn="true"
android:layout_centerVertical="true"
android:layout_alignStart="#+id/runner1Btn"
android:layout_marginTop="15dp"
android:layout_below="#+id/runner1Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner3Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_centerVertical="true"
android:layout_alignParentStart="false"
android:layout_below="#+id/runner2Btn"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner4Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner3Btn"
android:layout_alignParentStart="false"
android:isScrollContainer="false"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner5Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner4Btn"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner6Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner5Btn"
android:layout_alignStart="#id/runner1Btn"
android:layout_marginTop="15dp"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner7Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner6Btn"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner8Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:isScrollContainer="true"
android:keepScreenOn="true"
android:layout_centerVertical="true"
android:layout_alignStart="#+id/runner1Btn"
android:layout_marginTop="15dp"
android:layout_below="#+id/runner7Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner9Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_centerVertical="true"
android:layout_alignParentStart="false"
android:layout_below="#+id/runner8Btn"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner10Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner9Btn"
android:layout_alignParentStart="false"
android:isScrollContainer="false"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner11Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner10Btn"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner12Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner11Btn"
android:layout_alignStart="#id/runner1Btn"
android:layout_marginTop="15dp"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner13Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner12Btn"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner14Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner13Btn"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner15Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:isScrollContainer="true"
android:keepScreenOn="true"
android:layout_centerVertical="true"
android:layout_alignStart="#+id/runner1Btn"
android:layout_marginTop="15dp"
android:layout_below="#+id/runner14Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner16Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_centerVertical="true"
android:layout_alignParentStart="false"
android:layout_below="#+id/runner15Btn"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner17Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner16Btn"
android:layout_alignParentStart="false"
android:isScrollContainer="false"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner18Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner17Btn"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone"
android:focusableInTouchMode="false" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner19Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner18Btn"
android:layout_alignStart="#id/runner1Btn"
android:layout_marginTop="15dp"
android:visibility="gone" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="110dp"
android:layout_height="40dp"
android:id="#+id/runner20Btn"
android:background="#101fbd"
android:textColor="#FFFFFFFF"
android:textSize="20dp"
android:layout_below="#+id/runner19Btn"
android:layout_marginTop="15dp"
android:layout_alignStart="#id/runner1Btn"
android:visibility="gone" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner2TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner2Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="false" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner3TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner3Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner4TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner4Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner5TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner5Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner6TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner6Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner7TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner7Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner8TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner8Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="false" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner9TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner9Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner10TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner10Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner11TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner11Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner12TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner12Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner13TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner13Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner14TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner14Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner15TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner15Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="false" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner16TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner16Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner17TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner17Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner18TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner18Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner19TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner19Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/runner20TimeView"
android:layout_marginRight="0dp"
android:textColor="#000000"
android:textSize="30dp"
android:textIsSelectable="true"
android:layout_alignBaseline="#+id/runner20Btn"
android:visibility="gone"
android:layout_alignEnd="#id/runner1TimeView"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</ScrollView>
Here is my JAVA code for the OnClickListener for one of the buttons.
runner[18].setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
if (runnerRunning[18]) {
time[18] = System.currentTimeMillis() - startTime;
runners.get(18).setTime(formatTime(time[18]));
runnerTime[18].setText(formatTime(time[18]));
runnerRunning[18] = false;
}
}
});
I have this Food Diary layout. Under the Add Food Button for each of the Breakfast, Lunch and Dinner Headings. A listview should appear with a list of food items added in it. Initially it will be empty so it should appear with the food items when something gets added in it.
I've written the xml for the layout but I haven't been able to successfully set the listview in it
<?xml version="1.0" encoding="utf-8"?>
<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:weightSum="20"
tools:context="hamza.example.fitkitapp.Food_Diary">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorBlueTopBar"
android:text="#string/FoodDiary"
android:textColor="#color/colorWhiteTopBarText"
android:textSize="#dimen/topBarText" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="35dp"
android:text="Today"
android:gravity="center"
android:id="#+id/textView"
android:textColor="#color/colorWhiteTopBarText"
android:textSize="19sp"
android:background="#color/colorgray"
android:layout_weight="0.04" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="22dp">
<TextView
android:layout_width="50dp"
android:layout_height="21dp"
android:text="2,230"
android:textSize="19dp"
android:layout_marginLeft="10dp"
android:textColor="#color/colorBlack"
android:id="#+id/textView2"
android:layout_weight="0.04" />
<TextView
android:layout_width="15dp"
android:layout_height="21dp"
android:text="-"
android:textSize="19sp"
android:textColor="#color/colorBlack"
android:id="#+id/textView101"
android:layout_marginLeft="30dp"
android:layout_weight="0.04" />
<TextView
android:layout_width="40dp"
android:layout_height="21dp"
android:text="8"
android:textSize="19sp"
android:textColor="#color/colorBlack"
android:id="#+id/textView100"
android:layout_marginLeft="30dp"
android:layout_weight="0.04" />
<TextView
android:layout_width="40dp"
android:layout_height="21dp"
android:text="="
android:textSize="19sp"
android:textColor="#color/colorBlack"
android:id="#+id/textView102"
android:layout_marginLeft="20dp"
android:layout_weight="0.04" />
<TextView
android:layout_width="50dp"
android:layout_height="21dp"
android:text="1,230"
android:textSize="19sp"
android:textColor="#color/colorBlack"
android:id="#+id/textView105"
android:layout_marginLeft="30dp"
android:layout_weight="0.04" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="50dp"
android:layout_height="21dp"
android:text="Goal"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:id="#+id/textView106"
android:layout_marginLeft="30dp"
android:layout_weight="0.04" />
<TextView
android:layout_width="50dp"
android:layout_height="21dp"
android:text="Food"
android:textSize="15sp
android:textColor="#color/colorBlack"
android:id="#+id/textView107"
android:layout_marginLeft="70dp"
android:layout_weight="0.04" />
<TextView
android:layout_width="80dp"
android:layout_height="21dp"
android:text="Remaining"
android:textSize="15sp"
android:textColor="#color/colorBlack"
android:id="#+id/textView108"
android:layout_marginLeft="75dp"
android:layout_weight="0.04" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="360dp"
android:layout_height="20dp"
android:background="#color/colorDarkBlue"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginLeft="110dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="Calories"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginLeft="175dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="Carbs"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginLeft="225dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="Fat"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginLeft="255dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="Protein"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:layout_marginLeft="310dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="Sugars"/>
</FrameLayout>
</LinearLayout>
<LinearLayout
android:layout_width="360dp"
android:layout_height="20dp">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="360dp"
android:layout_height="20dp"
android:background="#color/colorDarkBlue"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_marginLeft="125dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="kcal"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_marginLeft="185dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="g"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_marginLeft="232dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="g"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_marginLeft="275dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="g"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_marginLeft="325dp"
android:textColor="#color/colorWhiteTopBarText"
android:text="g"
/>
</FrameLayout>
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="32dp"
android:text="Breakfast"
android:id="#+id/textView3"
android:textSize="19dp"
android:gravity="start|center"
android:textColor="#color/colorWhiteTopBarText"
android:background="#color/colorBlueTopBar"
android:layout_weight="0.05" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="45dp">
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:background="#drawable/add"
android:layout_marginTop="5dp"
android:id="#+id/addFood1"
android:layout_marginLeft="4dp"
android:layout_marginBottom="-250dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="30dp"
android:text=" Add Food"
android:layout_marginTop="7dp"
android:id="#+id/textView4"
android:textColor="#color/colorBlueTopBar"
android:textSize="19dp" />
</LinearLayout>
<ListView
android:id="#+id/listviewBreakfast"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="100dp">
</ListView>
<TextView
android:layout_width="match_parent"
android:layout_height="32dp"
android:text="Lunch"
android:id="#+id/lunch"
android:textSize="19dp"
android:gravity="start|center"
android:textColor="#color/colorWhiteTopBarText"
android:background="#color/colorBlueTopBar"
android:layout_weight="0.05" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="45dp">
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:background="#drawable/add"
android:id="#+id/addFood2"
android:layout_marginTop="5dp"
android:layout_marginLeft="4dp"
android:layout_marginBottom="-250dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="30dp"
android:text=" Add Food"
android:id="#+id/add_lunch"
android:layout_marginTop="7dp"
android:textColor="#color/colorBlueTopBar"
android:textSize="19dp" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="32dp"
android:text="Dinner"
android:gravity="start|center"
android:id="#+id/dinner"
android:textSize="19dp"
android:textColor="#color/colorWhiteTopBarText"
android:background="#color/colorBlueTopBar"
android:layout_weight="0.05" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="45dp">
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:background="#drawable/add"
android:layout_marginTop="5dp"
android:id="#+id/addFood3"
android:layout_marginLeft="4dp"
android:layout_marginBottom="-250dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="30dp"
android:text=" Add Food"
android:id="#+id/add_dinner"
android:layout_marginTop="7dp"
android:textColor="#color/colorBlueTopBar"
android:textSize="19dp" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="32dp"
android:text="Totals"
android:id="#+id/total"
android:textSize="19dp"
android:gravity="start|center"
android:textColor="#color/colorWhiteTopBarText"
android:background="#color/colorBlueTopBar"
android:layout_weight="0.05" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="35dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Goals"
android:textColor="#color/colorBlack"
android:textSize="19dp"
android:id="#+id/textView5"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="2,230"
android:layout_marginLeft="75dp"
android:textColor="#color/colorBlack"
android:textSize="15dp"
android:id="#+id/textView1011"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="278"
android:layout_marginLeft="25dp"
android:textColor="#color/colorBlack"
android:textSize="15dp"
android:id="#+id/textView1012"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="74"
android:layout_marginLeft="25dp"
android:textColor="#color/colorBlack"
android:textSize="15dp"
android:id="#+id/textView1013"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="111"
android:layout_marginLeft="25dp"
android:textColor="#color/colorBlack"
android:textSize="15dp"
android:id="#+id/textView1014"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="2,300"
android:layout_marginLeft="10dp"
android:textColor="#color/colorBlack"
android:textSize="15dp"
android:id="#+id/textView1015"
android:layout_weight="0.24" />
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/divider"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="35dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Remaining"
android:textSize="19dp"
android:textColor="#color/colorBlack"
android:id="#+id/textView6"
android:layout_weight="0.19" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="2,230"
android:layout_marginLeft="35dp"
android:textColor="#color/colorGreenCalories"
android:textSize="15dp"
android:id="#+id/textView1041"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="278"
android:layout_marginLeft="25dp"
android:textColor="#color/colorGreenCalories"
android:textSize="15dp"
android:id="#+id/textView1042"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="74"
android:layout_marginLeft="25dp"
android:textColor="#color/colorGreenCalories"
android:textSize="15dp"
android:id="#+id/textView101443"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="111"
android:layout_marginLeft="25dp"
android:textColor="#color/colorGreenCalories"
android:textSize="15dp"
android:id="#+id/textView10444"
android:layout_weight="0.24" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="2,300"
android:layout_marginLeft="10dp"
android:textColor="#color/colorGreenCalories"
android:textSize="15dp"
android:id="#+id/textView10435"
android:layout_weight="0.24" />
</LinearLayout>
<Button
android:layout_width="123dp"
android:layout_height="40dp"
android:text="Make Entry"
android:layout_marginBottom="-20dp"
android:background="#color/colorgray"
android:layout_gravity="center"
android:id="#+id/Btn_MakeEntry"
android:textColor="#color/colorWhiteTopBarText"
android:textSize="17dp"
android:layout_weight="0.10" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#drawable/bottom_bar"
android:layout_marginTop="40dp"
>
<Button
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginBottom="4dp"
android:layout_marginLeft="4dp"
android:layout_gravity="bottom"
android:text="#string/Home"
android:id="#+id/Btn_Home1"
android:background="#color/colorBlueTopBar"
android:textColor="#color/colorWhiteTopBarText"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="130dp"
android:layout_marginTop="7dp"
android:text="#string/FoodDiary"
android:id="#+id/Btn_FD1"
android:background="#color/colorBlueTopBar"
android:textColor="#color/colorWhiteTopBarText"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginTop="7dp"
android:layout_marginLeft="270dp"
android:layout_marginRight="2dp"
android:text="#string/Progress"
android:id="#+id/Btn_Progress1"
android:background="#color/colorBlueTopBar"
android:textColor="#color/colorWhiteTopBarText"
/>
</FrameLayout>
</LinearLayout>
</RelativeLayout>
Is it somehow possible to let it grow and not affect the Lunch textview below it?
[Update 1]
I tried with the expandable listview. Made three of them under the Breakfast,Lunch and Dinner Headings. I haven't been successful with them also.
You can't not affect all the stuff below. I suggest placing it in a listview though, so that the user can scroll through.
Use expandable listview where addfood will be parent and add fooditems as its child view. You will have to use three different listviews for three categories.
Motorolla XOOM, Android 3.2. After my resource preloader(you can see a progressbar of it on the picture below) has finished his work, this window shows up, but it's height is not stretched to fill all screen. How can it be fixed?
Image: http://img441.imageshack.us/img441/1523/device20120319140942.png
Here is my layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mainMenu"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/menu_bg" >
<RelativeLayout
android:id="#+id/button_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<Button
android:id="#+id/continue_button"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:background="#drawable/derp"
android:text="#string/continue_text"
android:textColor="#color/main_red"
android:textSize="30dp"
android:textStyle="bold" />
<Button
android:id="#+id/play"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_below="#id/continue_button"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#drawable/derp"
android:text="#string/playGame"
android:textColor="#color/main_blue"
android:textSize="30dp"
android:textStyle="bold" />
<Button
android:id="#+id/leaderboard"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_below="#id/play"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#drawable/derp"
android:text="#string/leaderboard"
android:textColor="#color/main_blue"
android:textSize="30dp"
android:textStyle="bold" />
<Button
android:id="#+id/settings"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_below="#id/leaderboard"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#drawable/derp"
android:text="#string/settings"
android:textColor="#color/main_blue"
android:textSize="30dp"
android:textStyle="bold" />
<Button
android:id="#+id/exit"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_below="#id/settings"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#drawable/derp"
android:text="#string/closeGame"
android:textColor="#color/main_blue"
android:textSize="30dp"
android:textStyle="bold" />
</RelativeLayout>
<TextView
android:id="#+id/nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#id/button_layout"
android:text="TextView"
android:layout_marginBottom="30dp"
android:layout_centerHorizontal="true"
android:textColor="#color/main_red"
android:textSize="20dp" />
<TextView
android:id="#+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#id/button_layout"
android:layout_marginTop="50dp"
android:text="TextView"
android:textColor="#color/main_blue"
android:textSize="14dp" />
</RelativeLayout>
Try with this code
<RelativeLayout
android:id="#+id/button_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<Button
android:id="#+id/continue_button"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:background="#drawable/derp"
android:text="#string/continue_text"
android:textColor="#ff0000"
android:textSize="30dp"
android:textStyle="bold" />
<Button
android:id="#+id/play"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_below="#id/continue_button"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#drawable/derp"
android:text="#string/playGame"
android:textColor="#ff0000"
android:textSize="30dp"
android:textStyle="bold" />
<Button
android:id="#+id/leaderboard"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_below="#id/play"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#drawable/derp"
android:text="#string/leaderboard"
android:textColor="#ff0000"
android:textSize="30dp"
android:textStyle="bold" />
<Button
android:id="#+id/settings"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_below="#id/leaderboard"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#drawable/derp"
android:text="#string/settings"
android:textColor="#ff0000"
android:textSize="30dp"
android:textStyle="bold" />
<Button
android:id="#+id/exit"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_below="#id/settings"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#drawable/derp"
android:text="#string/closeGame"
android:textColor="#ff0000"
android:textSize="30dp"
android:textStyle="bold" />
</RelativeLayout>
<TextView
android:id="#+id/version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#id/button_layout"
android:layout_marginTop="50dp"
android:text="TextView"
android:textColor="#ff0000"
android:textSize="14dp" />
this code working for me
If this is also not working you have to use weight concept
Correct code check this xml file linearlayout missing in the top entry
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mainMenu" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#drawable/add_pic">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical"
android:layout_centerInParent="true" android:gravity="center">
<TextView android:id="#+id/nickname" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_above="#id/button_layout"
android:text="TextView" android:layout_marginBottom="30dp"
android:layout_centerHorizontal="true" android:textColor="#ff0000"
android:textSize="20dp" />
<RelativeLayout android:id="#+id/button_layout"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true">
<Button android:id="#+id/continue_button"
android:layout_width="wrap_content" android:layout_height="40dp"
android:layout_centerHorizontal="true" android:background="#drawable/derp"
android:text="#string/continue_text" android:textColor="#ff0000"
android:textSize="30dp" android:textStyle="bold" />
<Button android:id="#+id/play" android:layout_width="wrap_content"
android:layout_height="40dp" android:layout_below="#id/continue_button"
android:layout_centerHorizontal="true" android:layout_marginTop="10dp"
android:background="#drawable/derp" android:text="#string/playGame"
android:textColor="#ff0000" android:textSize="30dp"
android:textStyle="bold" />
<Button android:id="#+id/leaderboard" android:layout_width="wrap_content"
android:layout_height="40dp" android:layout_below="#id/play"
android:layout_centerHorizontal="true" android:layout_marginTop="10dp"
android:background="#drawable/derp" android:text="#string/leaderboard"
android:textColor="#ff0000" android:textSize="30dp"
android:textStyle="bold" />
<Button android:id="#+id/settings" android:layout_width="wrap_content"
android:layout_height="40dp" android:layout_below="#id/leaderboard"
android:layout_centerHorizontal="true" android:layout_marginTop="10dp"
android:background="#drawable/derp" android:text="#string/settings"
android:textColor="#ff0000" android:textSize="30dp"
android:textStyle="bold" />
<Button android:id="#+id/exit" android:layout_width="wrap_content"
android:layout_height="40dp" android:layout_below="#id/settings"
android:layout_centerHorizontal="true" android:layout_marginTop="10dp"
android:background="#drawable/derp" android:text="#string/closeGame"
android:textColor="#ff0000" android:textSize="30dp"
android:textStyle="bold" />
</RelativeLayout>
<TextView android:id="#+id/version" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_centerHorizontal="true"
android:layout_below="#id/button_layout" android:layout_marginTop="50dp"
android:text="TextView" android:textColor="#ff0000" android:textSize="14dp" />
</LinearLayout>
</RelativeLayout>