listView 一个简单的Item布局

来源:互联网 发布:dnf总网络连接中断 编辑:程序博客网 时间:2024/06/09 14:27

        很久没写博客了,想把它养成一种习惯,却一直没养成,记起来了就到这来写一写。

         废话不多说了,进入正题吧。因为一直做功能,ui界面不是很拿手(比较菜),现在公司没有了ui,那只能自己写(苦逼)。

 写一个listView填充Item的ui   半天不能适配各种分辨率,无奈只能求助现场观众(我们andBase群的一个好心大哥),要他指点一下我,结果三下五除二就弄出来了,且各种分辨率可适配,果然是菜鸟于高手的区别啊!上代码吧


下面是效果图: 


<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:orientation="vertical"    android:background="#fff" >    <RelativeLayout         android:layout_width="match_parent"        android:layout_height="wrap_content">    <LinearLayout     android:layout_width="match_parent"    android:layout_height="wrap_content"    android:layout_marginTop="18dp"    android:layout_marginLeft="14dp"    android:orientation="horizontal" >        <ImageView            android:id="@+id/attention_imageView_log"    android:layout_width="76dp"    android:layout_height="76dp"    android:layout_marginRight="10dp"    android:src="@drawable/azhong_weixin"/>                <LinearLayout             android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:orientation="vertical">            <TextView                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:text="签到任务"                android:textColor="@color/black"                android:textSize="14sp" />            <LinearLayout                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:layout_marginTop="12dp"                android:orientation="horizontal" >                <ImageView                 android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:src="@drawable/attention_rawad"/>                <TextView                 android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:layout_marginLeft="8dp"                android:textSize="13sp"                android:textColor="@color/red"                android:text="@string/attention_award"/>            </LinearLayout>            <LinearLayout                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:layout_marginTop="8dp"                android:orientation="horizontal" >                <TextView                 android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:layout_marginLeft="47dp"                android:textSize="13sp"                android:textColor="@color/red"                android:text="@string/attention_tiem"/>            </LinearLayout>        </LinearLayout>            </LinearLayout>        <TextView         android:id="@+id/attention_tv_go"        android:layout_width="65dp"        android:layout_height="30dp"       android:layout_alignParentRight="true"       android:layout_marginTop="12dp"       android:layout_marginRight="16dp"        android:gravity="center"        android:text="保存"        android:textSize="16sp"        android:textColor="#fff"        android:background="#00a6f0"/>            </RelativeLayout>        <View        android:layout_width="match_parent"        android:layout_height="1dp"        android:layout_marginTop="19dp"        android:background="#f5f5f5" />    <LinearLayout         android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_marginTop="13dp"        android:layout_marginBottom="12dp"        android:layout_marginLeft="9dp"        android:layout_marginRight="9dp"        android:orientation="vertical">        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:singleLine="true"            android:textColor="#888"            android:textSize="14sp"            android:text="@string/attention_step1"            android:drawableLeft="@drawable/attention_1"            android:drawablePadding="6dp" />        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_marginTop="8dp"            android:singleLine="true"            android:textColor="#888"            android:textSize="14sp"            android:text="@string/attention_step2"            android:drawableLeft="@drawable/attention_2"            android:drawablePadding="6dp" />        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_marginTop="8dp"            android:singleLine="true"            android:textColor="#888"            android:textSize="14sp"            android:text="@string/attention_step3"            android:drawableLeft="@drawable/attention_3"            android:drawablePadding="6dp" />    </LinearLayout>    </LinearLayout>


0 0
原创粉丝点击