0

画面の幅全体に表示され、実際の画像の高さ(wrap_content)を持ち、レイアウトの一番下に配置される画像を配置しようとしています。

以下のコードを記述しましたが、2番目の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>
4

2 に答える 2

2

user_board画像の下部に透明なスペースがありませんか?または、2番目のパディングフィールドに負の値を設定してみてくださいImageView

于 2012-07-12T14:38:14.797 に答える
1

を使用するandroid:scaleType="fitXY"と、に含まれるビットマップImageViewが全体に合わせてサイズ変更されますImageView。したがって、両方のimageViewでこの属性を使用すると、おそらくその空のスペースが非表示になります。ただし、これは画像のアスペクト比を維持しないことに注意してください。属性タグとそれが取ることができる可能な値の詳細については、ここを参照してください。android:scaleType

于 2012-07-12T14:34:52.130 に答える