I am using a simple ListView
in which every item contain only a text field and nothing else.
Here is my xml code for the list item:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:background="@drawable/bg_card">
<TextView
android:id="@+id/txt"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:textSize="15sp"
android:paddingLeft="6dip"
android:textColor="#878787"
android:textIsSelectable="true"/>
</LinearLayout>
</FrameLayout>
and here is my layout for the fragment using the list view.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e5e5e5">
<ListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:dividerHeight="0dp"
android:divider="@null"/>
</RelativeLayout>
Now, while creating an object of the adapter in my fragment like this
Level weather_data[] = new Level[] {
new Level(R.drawable.s1,
"Some text which will be present in the list item",
R.drawable.play_button)
};
If I have a very long sentence in the second parameter ie the text, some part of it does not get displayed and the sentence is displayed incomplete in the list item.
I have tried using android:minHeight
to change the height of the list item but it didn't work. What could be the solution to this?
Thanks