2013年8月24日星期六

Android This interface how to achieve

Own use RelativeLayout to write one, but a mess , you will how to write

------ Solution ------- -------------------------------------
divided into three
can linerlayout or RelativeLayout
------ Solution ------------------------------- -------------

------ Solution ----------------------------------- ---------
divided into three layout
left a Relative
middle of a Relative
right that is LinearLayout, and set this.setOrientation (VERTICAL) ;/ / display only one control line

Of course, we are all directly Relative absolute positioning is not bad.

------ Solution ------------------------------------ --------
a LinearLayout, inside 3 with RelativeLayout
------ Solution --------------------- -----------------------
simply get the next :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
    android:paddingTop="10dp" >

    <ImageView
        android:layout_width="0dp"
        android:layout_height="100dp"
        android:layout_marginRight="10dp"
        android:layout_weight="1"
        android:background="@android:color/darker_gray" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="100dp"
        android:layout_marginRight="10dp"
        android:layout_weight="1"
        android:orientation="vertical" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_marginBottom="10dp"
            android:layout_weight="1"
            android:background="@android:color/holo_green_light"
            android:text="this is title" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="4"
            android:background="@android:color/holo_orange_light"
            android:gravity="center"
            android:text="context" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="100dp"
        android:layout_weight="1"
        android:orientation="vertical" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:background="@android:color/holo_orange_light"
            android:text="TextView 0" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:background="@android:color/holo_orange_light"
            android:text="TextView 1" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:background="@android:color/holo_orange_light"
            android:text="TextView 2" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@android:color/holo_orange_light"
            android:text="TextView 3" />
    </LinearLayout>

</LinearLayout>

------ reference ------------------------------------- -


good good

没有评论:

发表评论