您的位置:首页 > 移动开发 > 微信开发

[Android]用LinearLayout 实现类微信消息列表项

2013-10-21 14:06 387 查看
实现效果:



微信参照界面:



一个关键点: "早晚报"与"下午19:05"之间要用空白TextView隔开,来造成一个靠左,一个靠右的效果

LinearLayout Item 结构如下

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView android:id="@+id/imageview_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/green"/>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:id="@+id/nickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="早晚报"/>
<TextView
android:id="@+id/nickname22"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:id="@+id/rightnickname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="下午19:05"/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/rightnickname2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="晚报:北京10日出租车涨价"/>
</LinearLayout>

</LinearLayout>
</LinearLayout>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: