2015-06-11 44 views
1

我从支持库中使用CardView我有一个RoundCorner图像里面,但半径不适用于图像是Cardview的问题或我的XML的问题? (我用这个RoundCorner图片库很多次,正常工作) 我测试这个在Nexus 5的Android L和仿真器的Nexus One的Android 4.1.1CardView里面的RoundCorner图像

这里是我的XML:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/tools" 
    xmlns:card_view="http://schemas.android.com/apk/res/com.rahavardnovin.Sada" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <android.support.v7.widget.CardView 
     android:id="@+id/card_view" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     card_view:cardCornerRadius="@dimen/radius_medium" 
     card_view:cardElevation="@dimen/cardview_default_elevation" 
     card_view:cardUseCompatPadding="true"> 

     <!-- date --> 
     <com.rahavardnovin.Sada.ui.customui.PersianTextView 
      android:id="@+id/newsDate" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="@dimen/global_padding" 
      android:layout_marginTop="3dp" 
      android:textSize="@dimen/textsize_smallest" /> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="right" 
      android:layout_marginBottom="@dimen/global_padding" 
      android:layout_marginLeft="@dimen/global_padding" 
      android:layout_marginRight="@dimen/global_padding" 
      android:layout_marginTop="@dimen/actionbar_items_size" 
      android:gravity="right" 
      android:orientation="horizontal"> 

      <com.makeramen.RoundedImageView 
       android:id="@+id/newsImage" 
       android:layout_width="@dimen/album_photo_width" 
       android:layout_height="@dimen/album_photo_height" 
       android:src="@drawable/avatar_agent" 
       app:riv_corner_radius="4dp" /> 

      <LinearLayout 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="right" 
       android:layout_marginBottom="@dimen/global_padding_small" 
       android:orientation="vertical" 
       android:paddingRight="10dp"> 


       <com.rahavardnovin.Sada.ui.customui.PersianTextView 
        android:id="@+id/newsTitle" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="right" 
        android:ellipsize="end" 
        android:textColor="@color/black_dark" 
        android:textSize="@dimen/textsize_large" /> 

       <com.rahavardnovin.Sada.ui.customui.PersianTextView 
        android:id="@+id/newsContent" 
        style="@style/Textview.Gray40" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="right" 
        android:ellipsize="end" 
        android:maxLines="4" 
        android:textSize="@dimen/abc_text_size_button_material" /> 
      </LinearLayout> 

     </LinearLayout> 

    </android.support.v7.widget.CardView> 
</RelativeLayout> 

回答

1

的XML命名空间您正在使用的是app:riv_corner_radius是错误的。它应该是

xmlns:app="http://schemas.android.com/apk/res-auto" 

,而不是

xmlns:app="http://schemas.android.com/tools" 
+0

哈,它的作品!谢谢 – Amir