2

How to create layout with like this image. 50% text and rest of 50% divide by imageview textview and imageview what do i do?

please help me. I want to create screen like this image help me please.

  <?xml version="1.0" encoding="utf-8"?>  
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/db1_root"
     android:orientation="vertical"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:weightSum="6"
     android:background="#333333" >


   <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#000000"
    android:layout_weight="0"
    android:weightSum="1.5"
    android:layout_marginBottom="1dp"
    android:orientation="horizontal" >

    <LinearLayout

    android:layout_marginRight="15dip"
    android:layout_marginLeft="15dp"
    android:layout_height="wrap_content"
    android:layout_width="0dip"
    android:background="@drawable/layoutborder"
    android:layout_marginBottom="1dp"
    android:layout_marginTop="1dp" 
    android:layout_weight="0.8"
    android:orientation="vertical" >


    <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.4"
            android:paddingLeft="1dip"
            android:src="@drawable/ic_launcher" />
     <TextView
        android:layout_width="wrap_content"
        android:layout_height="20dp"
        android:paddingTop="5dp"
        android:textSize="10dip"
        android:text=CONTAINS"
        android:textColor="#FFffff" />


       <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0.4"     
            android:paddingLeft="1dip"
            android:src="@drawable/ic_launcher" />
         </LinearLayout> 

          <TextView
            android:id="@+id/imageView1"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="0.7"
            android:paddingLeft="1dip"
            android:text="kurdfgkjdfuhfudshfkdshfdfhs
 kdjhfjdshfkjdshfkdshfkshjdhfskjhfksdhfksjhfkjsdhfkjsdhfk
 jshfshfshfdshdfshdkjfhsafkjsahdfksahdf" />


  </LinearLayout>


</LinearLayout>
4

2 回答 2

1

尽可能使用有助于快速渲染的最小布局。试试下面的代码。

<?xml version="1.0" encoding="utf-8"?>
   <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imgMainImage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/txtsubImgTitle"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_toLeftOf="@+id/textView1"
        android:src="@drawable/ic_launcher" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:text="TextView" />

    <ImageView
        android:id="@+id/imgSubImg"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignRight="@+id/imgMainImage"
        android:src="@drawable/ic_launcher" />

    <TextView
        android:id="@+id/txtsubImgTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/imgSubImg"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="16dp"
        android:text="TextView" />

   </RelativeLayout>
于 2013-07-17T10:55:16.873 回答
1

尝试

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/db1_root"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#333333"
    android:orientation="horizontal" >

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_marginBottom="1dp"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="15dp"
        android:layout_marginTop="1dp"
        android:layout_weight="1"
        android:background="@color/blue"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="0.4"
            android:paddingLeft="1dp"
            android:src="@drawable/login_down" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="20dp"
            android:layout_weight="0.2"
            android:paddingTop="5dp"
            android:text="CONTAINS"
            android:textColor="#FFffff"
            android:textSize="10dip" />

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="0.4"
            android:paddingLeft="1dp"
            android:src="@drawable/login_button" />
    </LinearLayout>

    <TextView
        android:id="@+id/imageView1"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:paddingLeft="1dp"
        android:text="kurdfgkjdfuhfudshfkdshfdfhs
     kdjhfjdshfkjdshfkdshfkshjdhfskjhfksdhfksjhfkjsdhfkjsdhfk
     jshfshfshfdshdfshdkjfhsafkjsahdfksahdf" />

</LinearLayout>
于 2013-07-17T10:52:01.680 回答