Nik*_*hil 0 java android android-layout
我希望在图像中使用与下面的布局完全相似的布局.我已经尝试了下面的代码,但它没有来.有人可以帮助我获得这种布局.
<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>
Run Code Online (Sandbox Code Playgroud)
尝试以下方法:
<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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
165 次 |
| 最近记录: |