0

この画像のような UI ヘッダーを作成するにはどうすればよいですか?

ここに画像の説明を入力

以下のコードを使用していますが、画面の 30% を画像に、70% を TextView に調整するにはどうすればよいですか。また、幅の 70% で 2 つの TextView を使用します。これは私のコードです。画像のようには見えません

<?xml version="1.0" encoding="UTF-8"?><LinearLayout   
   xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:background="#000000"
 android:orientation="vertical" >



  <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#=#EFECE5"

    android:orientation="horizontal" >

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


    />

    <TextView 
        android:id="@+id/txtCaption"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textColor="#ffffff"
        android:text="San Diego Uified"
       />

    <TextView 
        android:id="@+id/txtCaption"
        android:layout_width="fill_parent"
         android:layout_height="wrap_content"
        android:textColor="#ffffff"
        android:text="School District"
      />

    </LinearLayout>


  </LinearLayout>
4

4 に答える 4

2

画像とテキストにandroid:layout_weight="3"プロパティを追加するandroid:layout_weight="7"

于 2013-07-12T11:53:30.303 に答える
0

ととのチェックアウトweight_textviewsimageviewsweightSumLinearLayout

Androidのandroid:weightSumとは何ですか?どのように機能しますか?

于 2013-07-12T11:48:55.197 に答える
0

どうぞ..

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:background="#000000" android:orientation="vertical" >

<!-- Header Layout -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:orientation="horizontal"
android:weightSum="1.0" >
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#000000"
    android:orientation="horizontal"
    android:weightSum="0.30" >
 <ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:src="@drawable/ic_launcher"
/>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000"
    android:orientation="horizontal"
    android:weightSum="1.0" >
    <TextView 
        android:id="@+id/txtCaption"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:textColor="#ffffff"
        android:gravity="center"
        android:text="San Diego Uified"
        android:layout_weight="0.50"
       />

    <TextView 
        android:id="@+id/txtCaption"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:textColor="#ffffff"
        android:gravity="center"
        android:text="School District"
        android:layout_weight="0.50"
      />
    </LinearLayout>
    </LinearLayout>
</LinearLayout>

<!-- Body layout -->
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000"
    android:orientation="horizontal"
    android:layout_weight="0.70"
    android:weightSum="1.0" >
    <TextView 
        android:id="@+id/txtCaption"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:textColor="#ffffff"
        android:gravity="center"
        android:text="School aasdadadad adasd"
        android:layout_weight="0.50"
      />
</LinearLayout>

于 2013-07-12T12:13:18.440 に答える