Android 使用带有线性布局的整个屏幕时出现问题
我有一个非常简单的布局, 2个按钮、复选框、搜索栏和一些文本。。 它目前处于线性布局,我只能使用屏幕的一半,最多5-6行。 我想把按钮拖到按钮上,但我做不到。就像他们被困在一个只覆盖屏幕上半部分的框架里。有什么建议可以解决这个问题吗Android 使用带有线性布局的整个屏幕时出现问题,android,android-layout,Android,Android Layout,我有一个非常简单的布局, 2个按钮、复选框、搜索栏和一些文本。。 它目前处于线性布局,我只能使用屏幕的一半,最多5-6行。 我想把按钮拖到按钮上,但我做不到。就像他们被困在一个只覆盖屏幕上半部分的框架里。有什么建议可以解决这个问题吗 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" android:layou
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/statusText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/timerText"
android:layout_alignParentTop="true"
android:layout_marginTop="31dp"
android:text="@string/statusText"
android:textAppearance="?android:attr/textAppearanceLarge" />
<CheckBox
android:id="@+id/timerCB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/timerTime"
android:layout_centerHorizontal="true"
android:layout_marginTop="44dp"
android:onClick="activateTimer"
android:text="@string/timerCB" />
<Button
android:id="@+id/stop_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="20dp"
android:onClick="stopOperation"
android:text="@string/stop_button" />
<Button
android:id="@+id/start_button"
android:layout_width="319dp"
android:layout_height="wrap_content"
android:layout_above="@+id/stop_button"
android:layout_alignParentRight="true"
android:onClick="startOperation"
android:text="@string/start_button" />
<TextView
android:id="@+id/timerText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/statusText"
android:layout_centerHorizontal="true"
android:layout_marginTop="71dp"
android:enabled="false"
android:text="@string/timerText"
android:textAppearance="?android:attr/textAppearanceLarge" />
<SeekBar
android:id="@+id/timerTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/timerText"
android:layout_marginTop="32dp"
android:enabled="false"
android:max="90" />
</RelativeLayout>
至于外线布局,你试过了吗
android:layout_height="match_parent"
我还可以问你为什么选择
android:layout_height="0dp"
为了你的小部件?是否有理由不使用“包装内容”或非零值?请显示部分代码…我添加了布局xml。请注意,我对布局编码不太熟悉。我只是尝试以可视化的方式使用它,而不是xml方式。我删除了0dp行,改为包装内容,即使很难,我也不确定它的效果。我仍然不能按我的意愿移动东西你是什么意思,移动东西?在屏幕上拖动按钮到我想要的位置。在线性布局中,只有屏幕的上半部分可以工作。我试着回到Relative,这有点烦人,因为其余的都是依赖的,但在找到我想要的东西后,应用程序崩溃了。我把xml上传到了main post。它说复选框有问题,但我不明白到底是什么。我在布局视图中所做的所有更改。
android:layout_height="0dp"