【发布时间】:2011-08-16 23:29:30
【问题描述】:
我想在屏幕的右侧有一个按钮,以及一个编辑文本,它占据了按钮左侧的所有位置。我该怎么办?
此 xml 将屏幕左侧的按钮打印给我,但之前什么都没有:/
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<Button
android:id="@+id/index_bouton_recherche"
android:layout_width="45px"
android:layout_height="45px"
android:background="@drawable/loupe"
/>
<EditText
android:id="@+id/index_champs_recherche"
android:layout_width ="fill_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:layout_toLeftOf="@id/index_bouton_recherche"
/>
【问题讨论】:
-
将
android:layout_alignParentRight="true"添加到您的按钮,就是这样......使用线性布局,您将不得不为您的其余活动创建更多布局
标签: android drawing android-relativelayout fill-parent