The problem is that i want to show a card view like custom view inside a list view. the view is showing fine in emulator but its not showing the same in emulator.
Here is the link to the image in which both preview can be seen simultaneously.
Code for list view :
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/custom_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:divider="@android:color/transparent"
android:dividerHeight="10.0sp"
android:clipToPadding="false"
tools:listitem="@layout/listlayout">
</ListView>
Code for custom view:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:elevation="10dp">
<ImageView
android:layout_width="64dp"
android:layout_height="64dp"
android:id="@+id/productImage"
android:layout_gravity="center" />
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_marginLeft="5dp"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/product_title"
android:id="@+id/title"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="shortDescription"
android:textSize="@dimen/abc_text_size_body_1_material"
android:id="@+id/shortDescription" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="price"
android:id="@+id/price"
android:textAlignment="center"
android:gravity="center"
android:singleLine="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="newPrice"
android:singleLine="true"
android:id="@+id/newPrice"
android:autoText="false"
android:gravity="center" />
<Button
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Buy"
android:focusable="false"
android:focusableInTouchMode="false"
android:id="@+id/buy"
android:gravity="center"
android:layout_gravity="center" />
</LinearLayout>
</LinearLayout>