【发布时间】:2011-10-13 07:10:45
【问题描述】:
这是我拥有的静态 xml:
<LinearLayout
android:id="@+id/LinearLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:id="@+id/Header"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1.5"
android:background="@drawable/header_bg"
android:padding="0dp"
>
<ImageView
android:id="@+id/hLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:src="@drawable/logo"
/>
<TextView
android:id="@+id/hActiveCategory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Today"
android:textSize="18sp"
android:textColor="#FFFFFF"
/>
<Button
android:id="@+id/hRefreshButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:drawableRight="@drawable/refresh"
android:layout_alignParentRight="true"
android:padding="0dp"
/>
</RelativeLayout>
</LinearLayout>
发生了什么? - 当我尝试将 Button 与 id=hRefreshButton 对齐到其父级的右侧(RelativeLayout 与 id=Header)按钮和屏幕右边界之间仍有空间。为什么会这样?有什么建议?另外我必须强调我正在 AVD 模拟器上进行测试。
【问题讨论】:
标签: android user-interface alignment