开发者

How can we design the List View layout

How can we design the List View layout

I need to design the blow given UI using a list view

 I have to xml  conf.xml


 <?xml version="1.0" encoding="UTF-8"?>

   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent"
       android:paddingLeft="5dp"
    android:paddingRi开发者_JAVA百科ght="5dp">

   <TextView 
             android:layout_width="fill_parent" 
              android:layout_height="wrap_content"
              android:paddingTop="15dp"
               android:gravity="center"
                android:textColor="#FFFFFF"
            android:text="">
           </TextView> 

       <ListView android:id="@+id/ListView01"
        android:layout_height="wrap_content"
      android:layout_width="fill_parent">
      </ListView>


                        <TextView 
            android:id="@+id/TextViewEmpty"
             android:layout_width="fill_parent" 
              android:layout_height="fill_parent"
              android:paddingTop="10dp"

               android:gravity="center"
              android:textColor="#FFFFFF"
              android:typeface="sans"
            android:text="No Entries available">
           </TextView> 
                        </LinearLayout>

conf1.xml for the List View

     <?xml version="1.0" encoding="utf-8"?>

   <LinearLayout
    android:id="@+id/layout1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
     >


<TableRow android:id="@+id/ConfRow" android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:orientation="horizontal">

    <ImageView 
    android:id="@+id/imgPicture1" 
     android:layout_width="wrap_content"
     android:layout_height="50dp"
    android:src="@drawable/conf_line">
    </ImageView>


</TableRow>

  <LinearLayout
    android:id="@+id/layout1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
     >



    <TextView android:text="@+id/TextView02" android:id="@+id/TextView02"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_marginLeft="10dp" android:textColor="#FFFFFF"
        android:textAppearance="?android:attr/textAppearanceMedium"></TextView>

    <TextView android:text="@+id/TextView04" android:id="@+id/TextView04"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_marginLeft="10dp" android:textColor="#FFFFFF"
        android:textAppearance="?android:attr/textAppearanceSmall"></TextView>








</LinearLayout>

But the expected out put is not the same as the given image layout..Pls Help


Wheww.. I had a DejaVu seeing your question.

anyway, We create custom RowLayout to achieve this.

check this blog post out, while I try create a custom row layout for your case.

UPDATE Came to know that you're having issues with vertical line. you can use a view for it like this:

<View
  android:layout_width="1dip"
  android:layout_height="fill_parent"
  android:background="#FF0000FF"
/>

I hope it helps.

So your full layout makes something like this:

How can we design the List View layout

To get this, I have used the following XML:

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

<LinearLayout android:id="@+id/layout1"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView android:text="@+id/TextView02" 
        android:id="@+id/TextView02"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp" 
        android:textColor="#FFFFFF"
        android:layout_marginRight="100dip" 
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView android:text="@+id/TextView04" 
        android:id="@+id/TextView04"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp" 
        android:textColor="#FFFFFF"
        android:textAppearance="?android:attr/textAppearanceSmall" />

</LinearLayout>

<View android:layout_width="1dip" 
    android:layout_height="fill_parent"
    android:background="#FFFFFF" />

<ImageView android:id="@+id/imgPicture1"
    android:layout_width="wrap_content" 
    android:layout_height="50dp"
    android:src="@drawable/icon" />

</LinearLayout>

I hope it solves your issues now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜