2011-11-14 5 views
0

私は背景イメージを持つ相対レイアウトを持っていますが、イメージがすべてのレイアウトスペースを埋めるようにしたいと思う、パディングの問題だと思います。作業。 また、パディングを-1dipに設定する前に、階層型ビューアでパディングを検査します。 はここに私のxml相対レイアウトの背景がすべてのスペースを埋めていない

<RelativeLayout 
     android:id="@+id/relativeLayout2" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/gridView" 
     android:background="@drawable/tool_bar" 
     android:gravity="center" 
     > 

     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/locate" /> 

     <ImageView 
      android:id="@+id/imageView2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/imageView1" 
      android:src="@drawable/orbit" /> 

     <ImageView 
      android:id="@+id/imageView3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_toRightOf="@+id/imageView2" 
      android:src="@drawable/search" /> 

     <ImageView 
      android:id="@+id/imageView4" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/imageView3" 
      android:src="@drawable/snap" /> 

     <ImageView 
      android:id="@+id/imageView5" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@+id/imageView4" 
      android:src="@drawable/profile" /> 
    </RelativeLayout> 
thanks 

答えて

-1

だ私はあなたが相対的なレイアウトへ充填画像をしたいと思います。 あなたはそれを試してみてください。それはあなたを助けるかもしれません。 fill_parent

<ImageView 
      android:id="@+id/any_image" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:src="@drawable/profile_you" /> 
1

あなたはFILL_PARENTを使用し、幅と高さによって、すべてのスペースを埋めるためにしたいか、塗り幅ではなく高さのような1にそれらを埋めたい場合は、その後wrap_contentとして、またはしたい場合は、高さを設定した場合高さを記入していないし、それがいっぱいになり、その後幅、ここのような

幅するwrap_contentを設定し、両方の

<RelativeLayout 
     android:id="@+id/relativeLayout2" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_below="@+id/gridView" 
     android:background="@drawable/tool_bar" 
     android:gravity="center" 
     > 
</RelativeLayout> 
+0

私は背景イメージが相対レイアウトスペースを埋めるようにします。画面全体を埋めるための相対レイアウトではない – mauriyouth

0
<RelativeLayout 
    android:id="@+id/relativeLayout2" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/tool_bar" 
    > 

私はこのトリックをしなければならない

2

私は同じ問題にぶつかりました。私は、デフォルトでは、RelativeLayoutは背景をその次元に拡張しないと思う。

は次のように内部のビューを使用して終了:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="300px" 
android:layout_height="204px"> 
    <View 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"  
    android:background="@android:color/white"/> //Or whatever background you pick 
</RelativeLayout> 

ない私は期待していたソリューションが、とにかくソリューション。

関連する問題