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

实现效果: android

微信参照界面: 微信

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

LinearLayout Item 结构以下 xml

<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> io

相关文章
相关标签/搜索