android how can i force the button row to stay the same size
looking at the pictures maybe it's obvious what the problem is.
The button row insist on getting to big in portrait mood.Remove the
android:layout_below="@+id/cb_delete_files_option_activity"
then the
@+id/cb_delete_files_option_activity
checkbox is not visible in landscape mood.
anyone have some ide?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:id="@+id/ScrollView01"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
>
<RelativeLayout android:id="@+id/topRelativeLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:background="@color/send_background_color"
>
<TextView android:id="@+id/txt1_option_activity"
android:text = ""
android:textColor="#FFFFFF"
android:textSize="20sp"
android:layout_marginTop="20dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center_vertical|center_horizontal"
android:layout_alignParentTop="true"
/>
<TextView
android:id="@+id/txt2_option_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="20sp"
android:textColor="#ffffffff"
android:layout_centerHorizontal="true"
android:layout_below="@+id/txt1_option_activity"
>
</TextView>
<View android:id="@+id/just_a_line_option_activity"
android:background="#ffffff"
android:layout_width = "fill_parent"
android:layout_height="1dip"
android:layout_below="@+id/txt2_option_activity"
>
</View>
<TextView
android:id="@+id/txt3_option_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="#ffffffff"
android:layout_below="@+id/just_a_line_option_activity"
android:layout_centerHorizontal="true"
>
</TextView>
<TextView
android:id="@+id/txt_spinner_filesize_option_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="some settings"
android:textColor="#ffffffff"
android:layout_below="@+id/txt3_option_activity"
android:layout_toRightOf="@+id/spinner_filesize_option_activity"
>
</TextView>
<Spinner android:id="@+id/spinner_filesize_option_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txt3_option_activity"
>
</Spinner>
<TextView
android:id="@+id/txt_spinner_notificationtype_option_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="some settings"
android:textColor="#ffffffff"
android:layout_below="@+id/spinner_filesize_option_activity"
android:layout_toRightOf="@+id/spinner_notificationtype_option_activity"
>
</TextView>
<Spinner android:id="@+id/spinner_notificationtype_option_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:layout_below="@+id/spinner_filesize_option_activity"
>
</Spinner>
<TextView
android:id="@+id/txt_spinner_delay_option_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="some settings"
android:textColor="#ffffffff"
android:layout_below="@+id/spinner_notificationtype_option_activity"
android:layout_toRightOf="@+id/etx_delay_option_activity"
>
</TextView>
<EditText android:id="@+id/etx_delay_option_activity"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginTop="10dip"
android:layout_alignParentLeft="true"
android:layout_below="@+id/spinner_notificationtype_option_activity"
android:singleLine="true"
android:text="0"
/>
<CheckBox
android:id="@+id/cb_delete_files_option_activity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="some settings"
android:layout_below="@+id/etx_delay_option_activity"
android:layout_alignParentLeft="true"
>
</CheckBox>
<LinearLayout android:id="@+id/linerLayout_send_button_row"
android:orientation="horizontal"
android:background="@android:drawable/bottom_bar"
android:paddingLeft="4.0dip"
android:paddingTop="5.0dip"
android:paddingRight="4.0dip"
android:paddingBottom="1.0dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="@+id/cb_delete_files_option_activity"
>
<Button android:id="@+id/btn_send_activity_send_nr_two"
android:layout_width="0.0dip"
android:layout_height="fill_parent"
android:text="Send"
android:layout_weight="1.0"
/>
<Button android:i开发者_运维技巧d="@+id/btn_more_activity_send_nr_two"
android:layout_width="0.0dip"
android:layout_height="fill_parent"
android:text="More"
android:layout_weight="1.0"
/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
In the RelativeLayout
, it should be android:layout_height="wrap_content"
, NOT fill_parent
.
Wrap your entire LinearLayout
containing the buttons inside a NEW RelativeLayout
, placing the android:layout_below="@+id/cb_delete_files_option_activity"
inside it instead of in the LinearLayout
:
<!-- the rest of your xml -->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cb_delete_files_option_activity"
>
<LinearLayout android:id="@+id/linerLayout_send_button_row"
android:orientation="horizontal"
android:background="@android:drawable/bottom_bar"
android:paddingLeft="4.0dip"
android:paddingTop="5.0dip"
android:paddingRight="4.0dip"
android:paddingBottom="1.0dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
>
<Button android:id="@+id/btn_send_activity_send_nr_two"
android:layout_width="0.0dip"
android:layout_height="fill_parent"
android:text="Send"
android:layout_weight="1.0"
/>
<Button android:id="@+id/btn_more_activity_send_nr_two"
android:layout_width="0.0dip"
android:layout_height="fill_parent"
android:text="More"
android:layout_weight="1.0"
/>
</LinearLayout>
</RelativeLayout>
<!-- the rest of your xml -->
Use android:layout_height="wrap_content"
for both buttons and delete android:layout_below="@+id/cb_delete_files_option_activity"
from your linear layout.
精彩评论