2012-04-25 20 views
1

RelativeLayoutwidgetは、左境界線parentと右境界線widgetの間のスペースを完全に埋めるようにしますか?RelativeLayoutの空白を埋める

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 

    <EditText 
     android:id="@+id/vsname" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_toLeftOf="@+id/seticonimage" 
     android:hint="@string/entername" 
     android:inputType="text" /> 

    <EditText 
     android:id="@+id/vsdesc" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/vsname" 
     android:layout_toLeftOf="@+id/seticonimage" 
     android:hint="@string/shrtdesc" 
     android:inputType="text" /> 

    <Spinner 
     android:id="@+id/spinner" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/vsdesc" 
     android:layout_toLeftOf="@+id/seticonimage" 
     android:prompt="@string/icon_prompt" /> 

    <ImageView 
     android:id="@+id/seticonimage" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:layout_below="@+id/vsdesc" 
     android:adjustViewBounds="true" 
     android:contentDescription="@string/description" 
     android:scaleType="fitStart"/> 

    <TextView 
     android:id="@+id/memmory" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_below="@+id/seticonimage" 
     android:text="1000 MB" 
     android:textStyle="bold" /> 
</RelativeLayout> 

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" > 

    <LinearLayout 
     android:layout_width="96dp" 
     android:layout_height="match_parent" 
     android:orientation="vertical" 
     android:padding="3dp" > 

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:gravity="center_horizontal" 
      android:text="@string/cache" 
      android:textSize="16dp" /> 

     <NumberPicker 
      android:id="@+id/cache_size_picker" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="95dp" 
     android:layout_height="match_parent" 
     android:orientation="vertical" 
     android:padding="3dp" > 

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:gravity="center_horizontal" 
      android:text="@string/data" 
      android:textSize="16dp" /> 

     <NumberPicker 
      android:id="@+id/data_size_picker" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="96dp" 
     android:layout_height="match_parent" 
     android:gravity="center_horizontal" 
     android:orientation="vertical" 
     android:padding="3dp" > 

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:gravity="center_horizontal" 
      android:text="@string/system" 
      android:textSize="16dp" /> 

     <NumberPicker 
      android:id="@+id/system_size_picker" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 
    </LinearLayout> 
</LinearLayout> 

私は@id/memmoryが親と@id/spinnerの右の境界との間に空間全体を埋めるようにしたいです。

--------------------------------------------- 
|       |     | 
|       |     | 
|       |     | 
|       | ImageView | 
|  Stuff    |     | 
|       |     | 
|       |     | 
|       |----------------- 
|       | TextView  | 
---------------------------------------------- 
|            | 
|            | 
|            | 
|            | 
|            | 
|            | 
|            | 
|            | 
|            | 
|            | 
|     Stuff      | 
|            | 
|            | 
|            | 
|            | 
|            | 
|            | 
|            | 
|            | 
|            | 
|            | 
|            | 
|            | 
--------------------------------------------- 

これはTextViewが中央揃えであることに注意してください。私はtextviewのためにcompundDrawableを使ってみましたが、悲しいことにダイアログを膨らませても表示されません。親トップ - - trueの場合は、親権利 - 真、センター垂直 - 真、レイアウト幅&高さ - wrapcontent

テキスト1つの相対レイアウト内部

+0

投稿コード。 – Akram

+0

@Akkiさんがレイアウトコード –

+0

を投稿しました @ + id/memmoryのTextViewにandroid:layout_toLeftOf = "@ + id/spinner"を表示 – Akram

答えて

0

を埋める私はImageViewを取り除き、TextViewandroid:drawableTop属性を追加しました。これはインテントとして機能します。

<!-- <ImageView 
     android:id="@+id/seticonimage" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:adjustViewBounds="true" 
     android:contentDescription="@string/description" 
     android:scaleType="fitStart" 
     android:src="@drawable/cm7_icon" /> --> 

    <TextView 
     android:id="@+id/icon_and_memory" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:drawableTop = "@drawable/cm7_icon" 
     android:gravity="center_horizontal" 
     android:text="1000 MB" 
     android:textStyle="bold" /> 
0

すべてが

画像は、そのような画面を得ることで良いだろうビュー - 以下のレイアウト - 画像、左揃え - 画像、右揃え - 画像、レイアウト幅&高さ - wrapcontent

スタッフ1 - トップALIGN - 画像、下の整列 - テキストビューの左 - 画像、レイアウト幅&高さ - 包み込みコンテンツ

stuff2 - の下 - stuff1、レイアウト幅&高さ - 親

+0

私は修正が追加されている –

関連する問題