Adding a horizontalScrollView to bottom navigation bar - android

I have an activity which contains a table layout and below it I have some buttons, I then implemented a sort of navigation bar using radio group and radio buttons. What I want to do is add a horizontal scroll view to this radio group, however when I try to add it the navigation bar just changes position to the top of the activity to collapse with the table layout and I need this navigation bar to stick to the bottom of the activity. Any help would be much appreciated. Thanks in advance.
Here's my xml code:
<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:background="#drawable/bckgroundchinese"
android:id="#+id/bottom_layout" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarFadeDuration="0"
android:scrollbarSize="12dip" >
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="#3b3b3b" >
<TableLayout
android:id="#+id/myTableLayout"
android:layout_width="match_parent"
android:layout_height="276dp"
android:background="#drawable/bckgroundchinese" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NO PATIENTS" />
</TableLayout>
</HorizontalScrollView>
</ScrollView>
<Button
android:id="#+id/patient"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/radioGroup1"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="#drawable/buttonchinese"
android:text="Add Patient" />
<Button
android:id="#+id/signtOutDr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/patient"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="#drawable/buttonchinese"
android:text="sign out" />
<Button
android:id="#+id/info"
android:layout_width="450dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_above="#+id/alerts"
android:background="#drawable/buttonchinese"
android:text="Edit My Information" />
<Button
android:id="#+id/alerts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/signtOutDr"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="#drawable/buttonchinese"
android:text="View Alerts" />
<!--
<HorizontalScrollView
android:id="#+id/scrollView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbarFadeDuration="0"
android:scrollbarSize="5dip" >
-->
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="fill_parent"
android:layout_height="71dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#drawable/bckgroundchinese"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/btnAll"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:drawableTop="#drawable/navbar_allselector"
android:gravity="bottom|center_horizontal"
android:text="My Patients" />
<RadioButton
android:id="#+id/btnPicture"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:drawableTop="#drawable/doctoricon"
android:text="View Assistants" />
<RadioButton
android:id="#+id/btnVideo"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:drawableTop="#drawable/records"
android:text="Add Assistants" />
<RadioButton
android:id="#+id/btnFile"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:drawableTop="#drawable/phonebook_"
android:text="Add Patient" />
<RadioButton
android:id="#+id/btnEditInfo"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:drawableTop="#drawable/phonebook_"
android:text="Edit My Info" />
</RadioGroup>
<!-- </HorizontalScrollView> -->
</RelativeLayout>

Salma i have fixed your problem but removed some background image as it was not existing in my system so take below code and add those background image.
<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:id="#+id/bottom_layout" >
<HorizontalScrollView
android:id="#+id/mytabview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="#3b3b3b" >
<TableLayout
android:id="#+id/myTableLayout"
android:layout_width="match_parent"
android:layout_height="276dp"
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NO PATIENTS" />
</TableLayout>
</HorizontalScrollView>
<!--
<HorizontalScrollView
android:id="#+id/scrollView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbarFadeDuration="0"
android:scrollbarSize="5dip" >
-->
<!-- </HorizontalScrollView> -->
<LinearLayout
android:id="#+id/nav"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/mytabview" >
<Button
android:id="#+id/patient"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/buttonchinese"
android:text="Add Patient" />
<Button
android:id="#+id/signtOutDr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/buttonchinese"
android:text="sign out" />
<Button
android:id="#+id/info"
android:layout_width="450dp"
android:layout_height="wrap_content"
android:background="#drawable/buttonchinese"
android:text="Edit My Information" />
<Button
android:id="#+id/alerts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/buttonchinese"
android:text="View Alerts" />
</LinearLayout>
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="fill_parent"
android:layout_height="71dp"
android:layout_alignParentBottom="true"
android:background="#drawable/bckgroundchinese"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/btnAll"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:drawableTop="#drawable/navbar_allselector"
android:gravity="bottom|center_horizontal"
android:text="My Patients" />
<RadioButton
android:id="#+id/btnPicture"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:drawableTop="#drawable/doctoricon"
android:text="View Assistants" />
<RadioButton
android:id="#+id/btnVideo"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:drawableTop="#drawable/records"
android:text="Add Assistants" />
<RadioButton
android:id="#+id/btnFile"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:drawableTop="#drawable/phonebook_"
android:text="Add Patient" />
<RadioButton
android:id="#+id/btnEditInfo"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:drawableTop="#drawable/phonebook_"
android:text="Edit My Info" />
</RadioGroup>
</RelativeLayout>

you need to move those properties:
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
from the RadioGroup to the HorizontalScrollView, Like this:
<HorizontalScrollView
android:id="#+id/scrollView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:scrollbarFadeDuration="0"
android:scrollbarSize="5dip" >
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="fill_parent"
android:layout_height="71dp"
android:background="#drawable/bckgroundchinese"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/btnAll"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:drawableTop="#drawable/navbar_allselector"
android:gravity="bottom|center_horizontal"
android:text="My Patients" />
<RadioButton
android:id="#+id/btnPicture"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:drawableTop="#drawable/doctoricon"
android:text="View Assistants" />
<RadioButton
android:id="#+id/btnVideo"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:drawableTop="#drawable/records"
android:text="Add Assistants" />
<RadioButton
android:id="#+id/btnFile"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:drawableTop="#drawable/phonebook_"
android:text="Add Patient" />
<RadioButton
android:id="#+id/btnEditInfo"
style="#style/navbar_button"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:drawableTop="#drawable/phonebook_"
android:text="Edit My Info" />
</RadioGroup>

Related

Android Scrollview Automatically scrolling up

I have a layout with a scrollview and a relative layout inside of the scrollview. I have toggle buttons radio groups and edittext inside this scrollview. The issue I am having is that when I start scrolling down and selecting the toggle buttons, after selection the screen scrolls up automatically to the top. Why is this happening?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#layout/grad_col_bk"
android:orientation="vertical" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.91"
android:background="#color/darker_grey" >
<RelativeLayout
android:id="#+id/main_rel_search_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ToggleButton
android:id="#+id/salinityToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:textOff="Salinity"
android:textOn="Salinity " />
<RadioGroup
android:id="#+id/radgroupsal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/salinityToggleButton"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/salGreat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedSalinityGreater"
android:text="Greater Than" />
<RadioButton
android:id="#+id/salLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedSalinityLess"
android:text="Less Than" />
</RadioGroup>
<View
android:id="#+id/salabove"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/radgroupsal"
android:background="#android:color/white" />
<EditText
android:id="#+id/salinityValue"
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/salinityToggleButton"
android:layout_alignBottom="#+id/salinityToggleButton"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#color/white"
android:ems="10"
android:inputType="numberDecimal" >
</EditText>
<ToggleButton
android:id="#+id/AmmoniaToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/salabove"
android:textOff="Ammonia"
android:textOn="Ammonia " />
<EditText
android:id="#+id/ammoniaSearchNumber"
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/AmmoniaToggleButton"
android:layout_alignBottom="#+id/AmmoniaToggleButton"
android:layout_alignRight="#+id/salinityValue"
android:background="#android:color/white"
android:ems="10"
android:inputType="numberDecimal"
android:paddingLeft="8dp" >
</EditText>
<RadioGroup
android:id="#+id/radgroupamm"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/AmmoniaToggleButton"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/ammGreat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedAmmoniaGreater"
android:text="Greater Than" />
<RadioButton
android:id="#+id/ammLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedAmmoniaLess"
android:text="Less Than" />
</RadioGroup>
<View
android:id="#+id/ammabove"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/radgroupamm"
android:background="#android:color/white" />
<!-- split below is nitrite -->
<ToggleButton
android:id="#+id/NitriteToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/ammabove"
android:textOff="Nitrite"
android:textOn="Nitrite " />
<EditText
android:id="#+id/nitriteValue"
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/NitriteToggleButton"
android:layout_alignBottom="#+id/NitriteToggleButton"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#color/white"
android:ems="10"
android:inputType="numberDecimal" >
</EditText>
<RadioGroup
android:id="#+id/radgroupnitri"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/NitriteToggleButton"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/nitriGreat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedNitriteGreater"
android:text="Greater Than" />
<RadioButton
android:id="#+id/nitriLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedNitriteLess"
android:text="Less Than" />
</RadioGroup>
<View
android:id="#+id/nitriabove"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/radgroupnitri"
android:background="#android:color/white" />
<!-- Nitrate Below -->
<ToggleButton
android:id="#+id/NitrateToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/nitriabove"
android:textOff="Nitrate"
android:textOn="Nitrate " />
<EditText
android:id="#+id/nitrateValue"
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/NitrateToggleButton"
android:layout_alignBottom="#+id/NitrateToggleButton"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#color/white"
android:ems="10"
android:inputType="numberDecimal" >
</EditText>
<RadioGroup
android:id="#+id/radgroupnitra"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/NitrateToggleButton"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/nitraGreat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedNitrateGreater"
android:text="Greater Than" />
<RadioButton
android:id="#+id/nitraLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedNitrateLess"
android:text="Less Than" />
</RadioGroup>
<View
android:id="#+id/nitraabove"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/radgroupnitra"
android:background="#android:color/white" />
<!-- pH Below -->
<ToggleButton
android:id="#+id/phToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/nitraabove"
android:textOff="pH"
android:textOn="pH " />
<EditText
android:id="#+id/phValue"
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/phToggleButton"
android:layout_alignBottom="#+id/phToggleButton"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#color/white"
android:ems="10"
android:inputType="numberDecimal" >
</EditText>
<RadioGroup
android:id="#+id/radgroupph"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/phToggleButton"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/phGreat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedPhGreater"
android:text="Greater Than" />
<RadioButton
android:id="#+id/phLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedPhLess"
android:text="Less Than" />
</RadioGroup>
<View
android:id="#+id/phabove"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/radgroupph"
android:background="#android:color/white" />
<!-- Calcium Below -->
<ToggleButton
android:id="#+id/calciumToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/phabove"
android:textOff="Calcium"
android:textOn="Calcium " />
<EditText
android:id="#+id/calciumValue"
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/calciumToggleButton"
android:layout_alignBottom="#+id/calciumToggleButton"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#color/white"
android:ems="10"
android:inputType="numberDecimal" >
</EditText>
<RadioGroup
android:id="#+id/radgroupcalcium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/calciumToggleButton"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/calciumGreat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedCalciumGreater"
android:text="Greater Than" />
<RadioButton
android:id="#+id/calciumLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedCaliumLess"
android:text="Less Than" />
</RadioGroup>
<View
android:id="#+id/calciumabove"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/radgroupcalcium"
android:background="#android:color/white" />
<!-- Phosphate Below -->
<ToggleButton
android:id="#+id/phosphateToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/calciumabove"
android:textOff="Phosphate"
android:textOn="Phosphate " />
<EditText
android:id="#+id/phosValue"
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/phosphateToggleButton"
android:layout_alignBottom="#+id/phosphateToggleButton"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#color/white"
android:ems="10"
android:inputType="numberDecimal" >
</EditText>
<RadioGroup
android:id="#+id/radgroupphosphate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/phosphateToggleButton"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/phosphateGreat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedPhosphateGreater"
android:text="Greater Than" />
<RadioButton
android:id="#+id/phosphateLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedPhosphateLess"
android:text="Less Than" />
</RadioGroup>
<View
android:id="#+id/phosphateabove"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/radgroupphosphate"
android:background="#android:color/white" />
<!-- temperature below -->
<ToggleButton
android:id="#+id/temperatureToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/phosphateabove"
android:textOff="Temperature"
android:textOn="Temperature " />
<EditText
android:id="#+id/temperatureValue"
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/temperatureToggleButton"
android:layout_alignBottom="#+id/temperatureToggleButton"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#color/white"
android:ems="10"
android:inputType="numberDecimal" >
</EditText>
<RadioGroup
android:id="#+id/radgrouptemperature"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/temperatureToggleButton"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/temperatureGreat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedTemperatureGreater"
android:text="Greater Than" />
<RadioButton
android:id="#+id/TemperatureLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedTemperatureLess"
android:text="Less Than" />
</RadioGroup>
<View
android:id="#+id/temperatureabove"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/radgrouptemperature"
android:background="#android:color/white" />
<!-- Alkalinity Below -->
<ToggleButton
android:id="#+id/alkalinityToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/temperatureabove"
android:textOff="Alkalinity"
android:textOn="Alkalinity " />
<EditText
android:id="#+id/AlkalinityValue"
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/alkalinityToggleButton"
android:layout_alignBottom="#+id/alkalinityToggleButton"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#color/white"
android:ems="10"
android:inputType="numberDecimal" >
</EditText>
<RadioGroup
android:id="#+id/radgroupalkalinity"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/alkalinityToggleButton"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/alkalinityGreat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedAlkalinityGreater"
android:text="Greater Than" />
<RadioButton
android:id="#+id/AlkalinityLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedAlkalinityLess"
android:text="Less Than" />
</RadioGroup>
<View
android:id="#+id/alkalinityabove"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/radgroupalkalinity"
android:background="#android:color/white" />
<!-- Magnesium Below -->
<ToggleButton
android:id="#+id/magnesiumToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/alkalinityabove"
android:textOff="Magnesium"
android:textOn="Magnesium " />
<EditText
android:id="#+id/MagnesiumValue"
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/magnesiumToggleButton"
android:layout_alignBottom="#+id/magnesiumToggleButton"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#color/white"
android:ems="10"
android:inputType="numberDecimal" >
</EditText>
<RadioGroup
android:id="#+id/radgroupmagnesium"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/magnesiumToggleButton"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/magnesiumGreat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedMagnesiumGreater"
android:text="Greater Than" />
<RadioButton
android:id="#+id/MagnesiumLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedMagnesiumLess"
android:text="Less Than" />
</RadioGroup>
<View
android:id="#+id/magnesiumabove"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/radgroupmagnesium"
android:background="#android:color/white" />
<!-- TDS below -->
<ToggleButton
android:id="#+id/tdsToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/magnesiumabove"
android:textOff="TDS"
android:textOn="TDS " />
<EditText
android:id="#+id/tdsValue"
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/tdsToggleButton"
android:layout_alignBottom="#+id/tdsToggleButton"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#color/white"
android:ems="10"
android:inputType="numberDecimal" >
</EditText>
<RadioGroup
android:id="#+id/radgrouptds"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tdsToggleButton"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/tdsGreat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedTdsGreater"
android:text="Greater Than" />
<RadioButton
android:id="#+id/tdsLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedTdsLess"
android:text="Less Than" />
</RadioGroup>
<View
android:id="#+id/tdsabove"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/radgrouptds"
android:background="#android:color/white" />
<!-- Iodine below -->
<ToggleButton
android:id="#+id/iodineToggleButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/tdsabove"
android:textOff="Iodine"
android:textOn="Iodine " />
<EditText
android:id="#+id/iodineValue"
android:layout_width="150dp"
android:layout_height="30dp"
android:layout_alignBaseline="#+id/iodineToggleButton"
android:layout_alignBottom="#+id/iodineToggleButton"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#color/white"
android:ems="10"
android:inputType="numberDecimal" >
</EditText>
<RadioGroup
android:id="#+id/radgroupiodine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/iodineToggleButton"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/iodineGreat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedIodineGreater"
android:text="Greater Than" />
<RadioButton
android:id="#+id/iodineLess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:onClick="onRadioButtonClickedIodineLess"
android:text="Less Than" />
</RadioGroup>
<View
android:id="#+id/iodineabove"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_below="#+id/radgroupiodine"
android:background="#android:color/white" />
<!-- Search button below -->
<Button
android:id="#+id/searchButton"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:layout_alignTop="#+id/iodineabove"
android:text="Search" />
</RelativeLayout>
</ScrollView>
This happens because one of the views on top takes focus.
Just add
android:focusableInTouchMode="true"
to the child of your ScrollView.

ViewFliper in layout

i am doing one application in android but i have one problem in layout file
i am doing by viewFliper
here is code
<?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" >
<TextView
android:id="#+id/Quesiontext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="44dp"
android:text="#string/Question"
android:textSize="18sp" />
<RadioGroup
android:id="#+id/radioGroupOptions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/Quesiontext"
android:layout_marginTop="30dp" >
<RadioButton
android:id="#+id/optionOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:text="#string/option1" />
<RadioButton
android:id="#+id/optionTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/option2" />
<RadioButton
android:id="#+id/optionthree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/option3" />
<RadioButton
android:id="#+id/optionFour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/option4" />
</RadioGroup>
<TextView
android:id="#+id/corrertView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/radioGroupOptions"
android:layout_marginRight="48dp"
android:text="#string/correct" />
<Button
android:id="#+id/btnNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/corrertView"
android:layout_below="#+id/corrertView"
android:layout_marginTop="42dp"
android:text="#string/Next"
android:textSize="16sp" />
<Button
android:id="#+id/Btnpervious"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/btnNext"
android:layout_alignBottom="#+id/btnNext"
android:layout_alignParentLeft="true"
android:text="#string/Pervious"
android:textSize="16sp" />
<RelativeLayout
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ViewFlipper
android:id="#+id/ViewFlipper01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/Quesiontext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="44dp"
android:text="#string/Question"
android:textSize="18sp" />
<RadioGroup
android:id="#+id/radioGroupOptions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/Quesiontext"
android:layout_marginTop="30dp" >
<RadioButton
android:id="#+id/optionOne"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:text="#string/option1" />
<RadioButton
android:id="#+id/optionTwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/option2" />
<RadioButton
android:id="#+id/optionthree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/option3" />
<RadioButton
android:id="#+id/optionFour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/option4" />
</RadioGroup>
<TextView
android:id="#+id/corrertView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#+id/radioGroupOptions"
android:layout_marginRight="48dp"
android:text="#string/correct" />
</ViewFlipper>
</RelativeLayout>
</RelativeLayout>
i didnt get it that how i put another button into ViewFliper ..its confusion and generating error...
You haven't closed your ViewFlipper with </ViewFlipper>
Could this be what you are looking for,
android:id="#+id/layout"
You missed a "+" symbol while creating a id.

Image is not fitting properly

I need mine to look like this, this is the iPhone version. Currently my android looks like this this. Here's the XML layout code.
<?xml version="1.0" encoding="UTF-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scrollview01"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativelayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="#+id/relativelayout02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="6dp"
android:paddingRight="6dp" >
<TextView
android:id="#+id/model"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="300"
android:textColor="#ffffff"
android:textSize="24sp"
android:textStyle="bold"
android:visibility="visible" />
<ImageView
android:id="#+id/brandname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:paddingTop="6dp"
android:src="#drawable/logo_chrysler" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativelayout04"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/relativelayout02"
android:background="#drawable/shape_header"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<RadioGroup
android:id="#+id/RadioGroup1"
android:layout_width="68dp"
android:layout_height="20dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal"
android:paddingTop="5dp" >
<RadioButton
android:id="#+id/option1"
android:layout_weight="2"
android:button="#drawable/custom_radio"
android:checked="true"
android:visibility="invisible" >
</RadioButton>
<RadioButton
android:id="#+id/option2"
android:layout_weight="2"
android:button="#drawable/custom_radio"
android:checked="false"
android:visibility="invisible" >
</RadioButton>
<RadioButton
android:id="#+id/option3"
android:layout_weight="2"
android:button="#drawable/custom_radio"
android:checked="true"
android:visibility="invisible" >
</RadioButton>
<RadioButton
android:id="#+id/option4"
android:layout_weight="2"
android:button="#drawable/custom_radio"
android:checked="false"
android:visibility="invisible" >
</RadioButton>
<RadioButton
android:id="#+id/option5"
android:layout_weight="2"
android:button="#drawable/custom_radio"
android:checked="false"
android:visibility="invisible" >
</RadioButton>
<RadioButton
android:id="#+id/option6"
android:layout_weight="2"
android:button="#drawable/custom_radio"
android:checked="false"
android:visibility="invisible" >
</RadioButton>
</RadioGroup>
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativelayout03"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#id/relativelayout04"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<ImageView
android:id="#+id/vehicleimg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignTop="#+id/relativelayout03"
android:src="#drawable/chrysler_twohundred" />
<ImageView
android:id="#+id/vhc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:src="#drawable/icon_vhc"
android:visibility="gone" />
<ImageView
android:id="#+id/subhead"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:src="#drawable/shape_subhead" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relativeLayout05"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#id/relativelayout03" >
<TextView
android:id="#+id/line1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/border" />
<TextView
android:id="#+id/status"
android:layout_width="fill_parent"
android:layout_height="28dp"
android:layout_centerInParent="true"
android:gravity="center"
android:text=""
android:textSize="16sp" />
<TextView
android:id="#+id/line2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/status"
android:background="#drawable/border" />
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relativeLayout05"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:focusable="true"
android:focusableInTouchMode="true" >
<ImageButton
android:id="#+id/unlock"
style="#style/chryslerButtonStyle"
android:padding="10dp"
android:src="#drawable/icon_unlock" />
<ImageButton
android:id="#+id/lock"
style="#style/chryslerButtonStyle"
android:padding="10dp"
android:src="#drawable/icon_lock" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/linearLayout01"
android:paddingLeft="4dp"
android:paddingRight="4dp" >
<ImageButton
android:id="#+id/remotestart"
style="#style/chryslerButtonStyle"
android:padding="10dp"
android:src="#drawable/icon_ignitionstart" />
<ImageButton
android:id="#+id/remoteturnoff"
style="#style/chryslerButtonStyle"
android:padding="10dp"
android:src="#drawable/icon_ignitionstop" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout03"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/linearLayout02"
android:background="#000000"
android:orientation="vertical"
android:paddingLeft="4dp"
android:paddingRight="4dp" >
<ImageButton
android:id="#+id/remotehornsandlights"
android:layout_width="fill_parent"
android:layout_height="75dp"
android:background="#drawable/chrysler_btn_bkg"
android:padding="10dp"
android:src="#drawable/icon_lightsandhorn" />
<Button
android:id="#+id/vehiclehealthcheck"
android:layout_width="fill_parent"
android:layout_height="75dp"
android:background="#drawable/chrysler_btn_bkg"
android:text="Vehicle Information"
android:textColor="#ffffff"
android:textSize="24sp" />
<Button
android:id="#+id/Tweddle"
android:layout_width="fill_parent"
android:layout_height="75dp"
android:background="#drawable/chrysler_btn_bkg"
android:drawableRight="#drawable/tweddle_status"
android:paddingLeft="82dp"
android:paddingRight="60dp"
android:text="Via Mobile"
android:textColor="#ffffff"
android:textSize="24sp"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout04"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout03"
android:background="#000000"
android:orientation="horizontal"
android:paddingLeft="4dp"
android:paddingRight="4dp" >
<ImageButton
android:id="#+id/contactus"
style="#style/chryslerButtonStyle"
android:src="#drawable/icon_contactus" />
<ImageButton
android:id="#+id/help"
style="#style/chryslerButtonStyle"
android:src="#drawable/icon_help" />
<ImageButton
android:id="#+id/ext1"
style="#style/chryslerButtonStyle"
android:background="#drawable/chrysler_btn_bkg"
android:visibility="invisible" />
<ImageButton
android:id="#+id/ext2"
style="#style/chryslerButtonStyle"
android:background="#drawable/chrysler_btn_bkg"
android:paddingRight="10dp"
android:visibility="invisible" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
When I double click the image from the graphical view layout, the following code is highlighted.
<ImageView
android:id="#+id/vehicleimg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignTop="#+id/relativelayout03"
android:src="#drawable/chrysler_twohundred" />
What I tried is I changed the layout_width and height to wrap content or fill_parent, tried various combinations of it. Also tried this in the #+id/relativelayout03. Anybody has an idea on this?
The problem is with the center images. It should be stretched out and should like the the first one, no borders, it should just blend in.
Thank you.
Have you try to set android:scaleType in the ImageView?
something like:
<ImageView
android:id="#+id/vehicleimg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignTop="#+id/relativelayout03"
android:src="#drawable/chrysler_twohundred"
android:scaleType="fitXY"/>
Please see http://developer.android.com/reference/android/widget/ImageView.html#attr_android:scaleType for available options.

Align radio buttons inside radio group

I'm developing an Android 3.1 Tablet application and asking this here because I haven't found any working answer (or example) in my code.
I have the following piece of code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<LinearLayout
android:id="#+id/materialsLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<!-- 0 . Título del fragment -->
<TextView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight=".5"
android:gravity="center_horizontal"
android:text="#string/layout_title_quantity"
android:textAppearance="?android:attr/textAppearanceLarge" />
<!-- 1. Texto -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/layout_qty_size_carton"
android:textAppearance="?android:attr/textAppearanceMedium" />
<!-- 2. Texto -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dip"
android:layout_gravity="center"
android:orientation="horizontal"
android:weightSum=".45" >
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".1"
android:gravity="right"
android:text="#string/layout_req_po"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".05"
android:text="#string/layout_qty_carton"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/qtyPerCartonTxt"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".05"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".01"
android:gravity="center"
android:text="#string/layout_slash"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".05"
android:text="#string/layout_cartoon_size"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/cartonSizeTxt"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".05"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".01"
android:gravity="center"
android:text="#string/layout_slash"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".03"
android:text="#string/layout_weight"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/cartonWeightTxt"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".05"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<!-- 3. Titulo tabla -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/layout_actual_finding"
android:textAppearance="?android:attr/textAppearanceMedium" />
<!-- 4. Cabecera tabla -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dip"
android:layout_gravity="center"
android:orientation="horizontal"
android:weightSum=".5" >
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".07"
android:gravity="center"
android:text="#string/layout_cartoon_number"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".07"
android:gravity="center"
android:text="#string/layout_actual_qty"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".07"
android:gravity="center"
android:text="#string/layout_actual_size"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".07"
android:gravity="center"
android:text="#string/layout_actual_weight"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Button
android:id="#+id/btnAddNewActPckCtr"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".05"
android:onClick="onAddNewActPckCtrClick"
android:text="#string/btn_add_new" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dip"
android:layout_gravity="center"
android:orientation="horizontal"
android:weightSum=".5" >
<TextView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".07"
android:gravity="right"
android:text="#string/layout_result"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RadioGroup
android:id="#+id/rGroupResQTYOnline"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_weight=".07"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/rResQTYOnlineYes"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:text="#string/layout_yes" />
<RadioButton
android:id="#+id/rResQTYOnlineNo"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:text="#string/layout_no" />
</RadioGroup>
<RadioGroup
android:id="#+id/rGroupResSzOnline"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".07"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/rResSzOnlineYes"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="#string/layout_yes" />
<RadioButton
android:id="#+id/rResSzOnlineNo"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="#string/layout_no" />
</RadioGroup>
<RadioGroup
android:id="#+id/rGroupResWgOnline"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".07"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/rResWgOnlineYes"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="#string/layout_yes" />
<RadioButton
android:id="#+id/rResWgOnlineNo"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="#string/layout_no" />
</RadioGroup>
<Button
android:id="#+id/btnTakeQtyOnlinePhoto"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight=".07"
android:onClick="onTakePhotoClick"
android:text="#string/btn_take_photo" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="40dip"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="40dip"
android:layout_marginTop="40dip"
android:layout_weight=".1"
android:gravity="left|center_vertical"
android:text="#string/layout_photos"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Gallery
android:id="#+id/quantityOnlineGallery"
android:layout_width="fill_parent"
android:layout_height="200dip" />
</LinearLayout>
</ScrollView>
I'm trying to center radio buttons inside radiogroup but I don't know how to do it.
I have tried this code:
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center|left"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|right" />
</RadioGroup>
But it doesn't work.
How can I do it?
It might help to try this:
Align your radio group to center
<RadioGroup
android:id="#+id/rGroupResSzOnline"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".07"
android:gravity="center"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/rResSzOnlineYes"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Yes" />
<RadioButton
android:id="#+id/rResSzOnlineNo"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="No" />
</RadioGroup>
Have you tried to nest a LinearLayout or RelativeLayout inside the RadioGroup and put the RadioButton within it? I haven't tried myself so I don't know if it works.

How to scroll in android LinearLayout?

Hi i have an application, where i want to use scroll option in liner layout. Please help me i am stuck.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:orientation="vertical"
android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true"
>
<AnalogClock android:id="#+id/clock1" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageButton android:id="#+id/rssbtn" android:src="#drawable/rss"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<ProgressBar android:id="#+id/progress"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<RadioGroup android:id="#+id/widget1" android:layout_width="wrap_content"
android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<RadioButton android:id="#+id/widget2"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Plain" android:checked="false" android:layout_gravity="left"
android:layout_weight="0">
</RadioButton>
<RadioButton android:id="#+id/widget3"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Serif" android:checked="true" android:layout_gravity="left"
android:layout_weight="0" android:typeface="serif">
</RadioButton>
<RadioButton android:id="#+id/widget25"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Bold" android:checked="false" android:layout_weight="0"
android:layout_gravity="left" android:textStyle="bold">
</RadioButton>
</RadioGroup>
<Spinner android:id="#+id/widget1" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:drawSelectorOnTop="false" />
<TimePicker android:id="#+id/widget3" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<CheckBox android:id="#+id/plain_cb" android:text="Plain"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<CheckBox android:id="#+id/serif_cb" android:text="Serif"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:typeface="serif" />
<CheckBox android:id="#+id/bold_cb" android:text="Bold"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textStyle="bold" />
<CheckBox android:id="#+id/italic_cb" android:text="Italic"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textStyle="italic" />
<Button android:id="#+id/button1" android:text="Label"
android:layout_width="fill_parent" android:layout_height="fill_parent" />
<Button android:id="#+id/button2" android:text="Label"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:typeface="serif" />
<Button android:id="#+id/button3" android:text="Label"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:textStyle="italic" />
<DatePicker android:id="#+id/datepicker"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<EditText android:id="#+id/edittext1" android:text="EditText 1"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<EditText android:id="#+id/button2" android:text="(206)555-1212"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:typeface="serif" android:phoneNumber="true" />
<EditText android:id="#+id/password" android:text="SuperSecret"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textStyle="bold" android:password="true" />
</LinearLayout>
Wrap your LinearLayout in a ScrollView at the top of the file
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="fill_parent">
<LinearLayout
android:layout_width="wrap_content" android:layout_height="fill_parent"
android:orientation="vertical"
android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true"
>
.....
</LinearLayout>
</ScrollView>

Categories

Resources