我想放置一個填充屏幕寬度的圖像,具有實際圖像的高度(wrap_content),並位於佈局的最底部。Android。 ImageView將不能正確定位
我已經寫了下面的代碼,但在第二個ImageView(帶有drawable/user_board的那個)和屏幕的最底部之間有一個小空間。爲什麼是這樣?我已經嘗試將填充和邊距設置爲0dp,但它似乎並沒有做到這一點。有任何想法嗎?
下面是代碼:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/LayoutBoard"
android:noHistory="true"
android:padding="0dp" >
<ImageView
android:src="@drawable/game_interface_background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="matrix" />
<ImageView
android:src="@drawable/user_board"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="0dp"
android:padding="0dp" />
</RelativeLayout>
您是否使用hierarchyviewer查看實際填充和邊距值在運行時的樣子? – MattC 2012-07-12 14:29:05
嗯。不,我以前沒有用過它,但我會將它谷歌它。謝謝。 – AndreiBogdan 2012-07-12 14:29:38
這對於這些事情非常有用。祝你好運! – MattC 2012-07-12 14:30:15