我的布局文件:
<?xml version="1.0" enCoding="utf-8"?><androID.support.v7.Widget.CardVIEw xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:androID.support.v7.cardvIEw="http://schemas.androID.com/apk/res-auto" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:elevation="5dp" androID:orIEntation="horizontal" androID.support.v7.cardvIEw:cardElevation="5dp"><relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:background="@drawable/List_selector" androID:paddingBottom="5dp"> <ImageVIEw androID:ID="@+ID/article_thumb" androID:layout_wIDth="match_parent" androID:layout_height="150dp" androID:layout_alignParenttop="true" androID:contentDescription="@string/app_name" androID:scaleType="centerCrop" /> <TextVIEw androID:ID="@+ID/article_Title" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_below="@+ID/article_thumb" androID:layout_marginEnd="10dp" androID:layout_marginleft="10dp" androID:layout_marginRight="10dp" androID:layout_marginStart="10dp" androID:ellipsize="mIDdle" androID:linksClickable="false" androID:longClickable="false" androID:text="@string/Title" androID:textAppearance="@style/TextAppearance.AppCompat.Title" androID:textcolor="@color/black" /> <TextVIEw androID:ID="@+ID/article_date" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignleft="@+ID/article_Title" androID:layout_alignStart="@+ID/article_Title" androID:layout_below="@+ID/article_Title" androID:layout_margintop="10dp" androID:text="@string/date" androID:textAppearance="@style/TextAppearance.AppCompat.light.Widget.PopupMenu.Small" androID:textcolor="@color/gray" /> <relativeLayout androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignEnd="@+ID/article_Title" androID:layout_alignRight="@+ID/article_Title" androID:layout_below="@+ID/article_Title" androID:layout_margintop="10dp" androID:elevation="30dp" androID:translationZ="30dp"> <ImageVIEw androID:ID="@+ID/redbubble" androID:layout_wIDth="25dp" androID:layout_height="25dp" androID:layout_gravity="center" androID:contentDescription="@string/app_name" androID:scaleType="centerCrop" androID:src="@drawable/redbubble" /> <TextVIEw androID:ID="@+ID/article_comment_bubble" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignParenttop="true" androID:layout_centerHorizontal="true" androID:textAppearance="@style/TextAppearance.AppCompat.Small" androID:textcolor="@color/white" /> </relativeLayout></relativeLayout>
所以在这个布局中我将这两行添加到relativeLayout以进行提升:
androID:elevation="30dp"androID:translationZ="30dp"
任何人都知道为什么没有显示?目前我使用AndroID API 21(Lollipop)使用模拟器进行测试.
解决方法 在xml的根布局中,您需要xmlns:card_vIEw="http://schemas.androID.com/apk/res-auto"
下面是cardvIEw的代码
card_vIEw:cardElevation="5dp"总结
以上是内存溢出为你收集整理的未显示CardView中View的Android高程全部内容,希望文章能够帮你解决未显示CardView中View的Android高程所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)