android - How to change andorid layout as per image given below -
currently listview design looks
where image on right hand side, title in bold , subtitle below it. changes need make in layout, below code. in advance.
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="4dp" android:orientation="vertical" > <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" > <imageview android:id="@+id/ivimage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="8dp" android:src="@drawable/ic_launcher"/> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <textview android:id="@+id/tvname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="tom cruise" android:textcolor="#166ced" android:textappearance="?android:attr/textappearancelarge" /> </linearlayout> </linearlayout> <textview android:id="@+id/tvdescriptionn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textcolor="#009a57" android:text="description" /> </linearlayout>
for better result manage view use relativelayout. can manage layout example give below-
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/linearlayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="4dp" android:orientation="vertical"> <android.support.v7.widget.cardview android:id="@+id/cardview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginleft="5dp" android:layout_marginright="5dp" android:layout_margintop="5dp" card_view:cardbackgroundcolor="@color/grey"> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content"> <imageview android:id="@+id/arrow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_centervertical="true" android:layout_marginright="5dp" android:src="@drawable/arrow"/> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_toleftof="@+id/arrow" android:orientation="vertical" > <textview android:id="@+id/tvname" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="murdochs needed counselling after hacking scandle says magazine" android:textcolor="#166ced" android:padding="5dp" android:textappearance="?android:attr/textappearancelarge" /> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" > <textview android:id="@+id/tvsubtitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_toleftof="@+id/ivimage" android:padding="5dp" android:text="new york:the british phone hacking scandle" android:textcolor="#000" android:textappearance="?android:attr/textappearancesmall" /> <imageview android:id="@+id/ivimage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="8dp" android:layout_centervertical="true" android:layout_alignparentright="true" android:src="@drawable/ic_launcher"/> </relativelayout> </linearlayout> </relativelayout> </android.support.v7.widget.cardview> </linearlayout>
Comments
Post a Comment