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>
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: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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在
RelativeLayout
中,它应该是android:layout_height="wrap_content"
,而不是fill_parent
。In the
RelativeLayout
, it should beandroid:layout_height="wrap_content"
, NOTfill_parent
.将包含按钮的整个
LinearLayout
包装在新的RelativeLayout
中,将android:layout_below="@+id/cb_delete_files_option_activity"
放入其中,而不是在 LinearLayout 中:Wrap your entire
LinearLayout
containing the buttons inside a NEWRelativeLayout
, placing theandroid:layout_below="@+id/cb_delete_files_option_activity"
inside it instead of in theLinearLayout
:对两个按钮使用
android:layout_height="wrap_content"
并从线性布局中删除android:layout_below="@+id/cb_delete_files_option_activity"
。Use
android:layout_height="wrap_content"
for both buttons and deleteandroid:layout_below="@+id/cb_delete_files_option_activity"
from your linear layout.