Skip to content Skip to sidebar Skip to footer

Listview In Nested Fragment Showing Empty List Item, (only Textviews Not Images)

After googling alot i never found any helpful answer, so i'm posting my issue here. My problem is as follows : I've a nested fragment (MainActivity calls SettingsFragment and that

Solution 1:

Your code should work, I think the problem is your contact_item.xml layout. Somehow your design is hiding the text. Use a simpler layout design to see if it shows the text, try getting rid of the LinearLayout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="55dp"
    android:background="@color/holo_gray_light"
    android:gravity="center_vertical" >

    <ImageView
        android:id="@+id/icon"
        android:layout_width="25dp"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginLeft="12dp"
        android:layout_marginRight="12dp"
        android:contentDescription="@string/desc_list_item_icon" />

    <View
        android:id="@+id/divider"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:layout_alignParentBottom="true"
        android:background="@android:color/darker_gray" />

    <ImageView
        android:id="@+id/ivCancel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:layout_marginRight="10dp"
        android:src="@drawable/ic_action_cancel" />

    <TextView
        android:id="@+id/tvName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_toLeftOf="@+id/ivCancel"
        android:layout_toRightOf="@+id/icon"
        android:gravity="center_vertical"
        android:paddingRight="40dp"
        android:ellipsize="end" 
        android:text="Nauman Zubair"/>

    <TextView
        android:id="@+id/tvValue"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_toLeftOf="@+id/ivCancel"
        android:layout_toRightOf="@+id/icon"
        android:paddingRight="40dp" 
        android:ellipsize="end"
        android:gravity="center_vertical"
        android:text="+92 123 1234567"/>

</RelativeLayout>

Post a Comment for "Listview In Nested Fragment Showing Empty List Item, (only Textviews Not Images)"