具有RelativeLayout
的自定義Dialog
框包含一個不會改變其邊距(無論方向如何)的Button
小部件。這裏的XML:相對佈局中的按鈕不受設置版面邊距的影響
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="horizontal" android:background="#99000000">
<TextView android:id="@+id/dialogtitle" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="Some text" />
<TextView android:id="@+id/dialogtext" android:layout_width="300dp"
android:layout_height="wrap_content" android:textSize="15dp"
android:layout_alignParentLeft="true" android:layout_below="@id/dialogtitle"
android:paddingLeft="8dp" />
<Button android:id="@+id/dialogbuttoninfo" android:layout_width="80dp"
android:layout_height="wrap_content" android:text="Doesn't care about margins"
android:layout_alignParentRight="true" android:layout_marginLeft="128dp" />
</RelativeLayout>
填充工程,但只移動按鈕內的文本。有什麼建議麼?
你想做什麼?我可以添加一個右邊距並且它可以工作 – 2011-06-08 19:19:40
它對於一個對話框,所以也許這也解釋了變異性 – 2011-06-09 00:30:05
也是,'mumps'標籤到底是什麼? – 2011-06-09 03:30:07