Android, как я могу заставить строку кнопки, чтобы остаться того же размера
Глядя на картинки, может быть, очевидно, в чем проблема.
Ряд кнопок настаивает на том, чтобы стать большим в портретном настроении.
Удалить
android:layout_below="@+id/cb_delete_files_option_activity"
тогда
@+id/cb_delete_files_option_activity
Флажок не виден в ландшафтном настроении.
У кого-нибудь есть идеи?
<?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: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>
</ScrollView>
3 ответа
Решение
Оберните все LinearLayout
содержащий кнопки внутри NEW RelativeLayout
, поместив android:layout_below="@+id/cb_delete_files_option_activity"
внутри, а не в 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 -->
В RelativeLayout
, так должно быть android:layout_height="wrap_content"
НЕ fill_parent
,
Использование android:layout_height="wrap_content"
для обеих кнопок и удаления android:layout_below="@+id/cb_delete_files_option_activity"
от вашего линейного макета.