2016-08-13 5 views
0

PercentRelativeLayoutでListViewを作成しようとしていますが、何も描画されません。リストビューのAndroid PercentRelativeLayoutに何も表示されない

私はandoird 4.4.4(APIレベル19)のGenymotionのカスタム電話を使用しています。

LinearLayoutのRelativeLayoutに切り替えると、項目が表示されます。 PercentRelativeLayoutでは、何も表示されません。

私は間違っていますか?

あなたのお手伝いをさせていただきます。

添付されているのは、リストビュー項目の醜いスキームです。 イメージアイテムはまだ含まれていません。

<?xml version="1.0" encoding="utf-8"?> 
<android.support.percent.PercentRelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <TextView 
     android:id="@+id/projects_lv_item_title" 
     android:layout_width="match_parent" 
     app:layout_heightPercent="50%" 
     /> 

    <TextView 
     android:id="@+id/projects_lv_item_desc" 
     android:layout_width="match_parent" 
     app:layout_heightPercent="50%" 
     /> 



</android.support.percent.PercentRelativeLayout> 

enter image description here

+0

上の私の質問** layout_heightのための正確な値を設定してみていますPercentRelativeLayoutに設定するか、** match_parent **に設定します。 –

答えて

0

PercentRelativeLayoutに明示的な高さを与える、との両方TextView秒にandroid:layout_height="wrap_content"を追加します。

+0

ありがとうございますが、PercentRelativeLayoutの全体点を無効にするだけではありませんか? – dotaneli

+0

いいえ、ビューが50%に収まらない場合、それは 'wrap_content'を試みます。それ以外の場合は、50%に固執する。 –

関連する問題