2016-08-13 103 views
0

我想用PercentRelativeLayout构建一个ListView,但它什么也没画。ListView中的Android PercentRelativeLayout不显示任何内容

我正在使用Genymotion的定制手机withoird 4.4.4(API级别19)。

当我切换到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精确值在** ** DP为PercentRelativeLayout或将其设置为** match_parent **。 –

回答

0

给出一个清楚的高度PercentRelativeLayout,并添加android:layout_height="wrap_content"TextView秒。

+0

谢谢,但不会只是使PercentRelativeLayout的整个点失效? – dotaneli

+0

不,如果视图不适合50%,它会尝试'wrap_content'。否则,坚持50%。 –