2016-05-25 23 views
0

bitte Ich habe dieses Layout in meiner App: enter image description hereTextview Artikel Höhe in Listview

und meine XML-Dateien definiert sind: content_main.xml:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:paddingBottom="@dimen/activity_vertical_margin" 
android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:context="cz.pavelmatras.prazskyhajzly.MainActivity" 
tools:showIn="@layout/activity_main"> 

<ListView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/lvSeznamHajzlu" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" /> 

und list_item.xml :

<?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="32dp" 
android:gravity="center" 
android:orientation="horizontal" 
android:padding="4dp" > 

<ImageView 
    android:id="@+id/ivImage" 
    android:layout_width="48dp" 
    android:layout_height="wrap_content" 
    android:layout_marginRight="16dp" 
    android:src="@drawable/wheel_chair" /> 

<TextView 
    android:id="@+id/tvText" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="TextView" /> 

Wie kann ich einen höheren Wert für TextView in ListView einstellen, um beide Textzeilen zu sehen?

Antwort

3

gesetzt, die Höhe der linearen Layout in list_item.xml von 32DP

<?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:gravity="center" 
android:orientation="horizontal" 
android:padding="4dp" > 

<ImageView 
    android:id="@+id/ivImage" 
    android:layout_width="48dp" 
    android:layout_height="wrap_content" 
    android:layout_marginRight="16dp" 
    android:src="@drawable/wheel_chair" /> 

<TextView 
    android:id="@+id/tvText" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="TextView" /> 
wrap_content