0
我試圖在左側位置的新圖層中添加片段下方的紅色按鈕(android:id="@+id/button8
),但它無法響應,仍然位於圖片頂部:如何在左下方的新圖層中添加按鈕
XML文件
<?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="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<LinearLayout
android:id="@+id/topLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="horizontal" >
<Button
android:id="@+id/button1"
android:layout_width="38dp"
android:layout_height="30dp"
android:background="#000000"/>
</LinearLayout>
<fragment
android:id="@+id/fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/topLayout" />
<LinearLayout
android:id="@+id/ttt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:orientation="horizontal" >
<Button
android:id="@+id/button8"
android:layout_width="38dp"
android:layout_height="30dp"
android:background="#FF0000" />
</LinearLayout>
在頂部 – user3350437
不行,仍然可以看到修正後的版本。 'layout_below''' below'' – cosmincalistru
我嘗試更正的代碼,但按鈕消失,我可以看到它的位置 – user3350437