我想要一个与图片中的布局完全相似的布局。我试过下面的代码,但它没有来。有人可以帮助我获得此布局。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip" >
<TextView
android:id="@+id/firstLine"
android:layout_width="fill_parent"
android:layout_height="26dip"
android:ellipsize="marquee"
android:singleLine="true"
android:text="Ali Connors"
android:textSize="12sp" />
<TextView
android:id="@+id/secondLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/firstLine"
android:gravity="center_vertical"
android:text="Brunch this weekend?"
android:textSize="16sp" />
<TextView
android:gravity="right"
android:id="@+id/rightTime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="15m"
android:textSize="16sp" />
</RelativeLayout>
尝试以下操作:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="#ED262A" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp">
<TextView
android:id="@+id/firstLine"
android:layout_width="fill_parent"
android:layout_height="26dp"
android:layout_alignParentLeft="true"
android:layout_marginTop="5dp"
android:ellipsize="marquee"
android:singleLine="true"
android:text="Ali Connors"
android:textSize="18sp" />
<TextView
android:id="@+id/secondLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/firstLine"
android:gravity="center_vertical"
android:text="Brunch this weekend?"
android:textSize="15sp" />
<TextView
android:id="@+id/thirdLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@id/secondLine"
android:drawablePadding="6dp"
android:drawableRight="@android:drawable/star_off"
android:gravity="center_vertical"
android:text="I will be in the place"
android:textColor="#A4A18E"
android:textSize="14sp" />
<TextView
android:id="@+id/rightTime"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_alignParentRight="true"
android:gravity="top|right"
android:text="15m"
android:textSize="16sp" />
</RelativeLayout>
</LinearLayout>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句