2015-06-12 28 views
6

Tôi có thể tùy chỉnh cardview theo cách như thế nào (trên cùng bên trái)?Làm thế nào để tùy chỉnh cardview?

Theo cách của tôi, nếu tôi thêm 3 hộp corored (màu xanh, xám, trắng) tôi luôn luôn có được một biên giới mỏng trên chu vi của hộp cardview. Ví dụ nào? Cảm ơn.

Example

+0

Tôi nghĩ rằng nó không phải là có thể với 'cardview' –

Trả lời

3

Bạn đã thử bố cục tương đối chưa?

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout 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"> 

    <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" 
         xmlns:app="http://schemas.android.com/apk/res-auto" 
         android:id="@+id/card_view" 
         android:layout_width="match_parent" 
         android:layout_height="230dp" 
         android:layout_marginBottom="@dimen/cardMarginVertical" 
         android:layout_marginLeft="@dimen/cardMarginHorizontal" 
         android:layout_marginRight="@dimen/cardMarginHorizontal" 
         android:layout_marginTop="@dimen/cardMarginVertical" 
         app:cardCornerRadius="2dp" 
         app:cardElevation="2dp" 
         app:cardPreventCornerOverlap="false" 
         app:contentPadding="0dp"> 

     <RelativeLayout 
          android:layout_width="match_parent" 
          android:layout_height="match_parent"> 
      <LinearLayout 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:orientation="horizontal"> 
       <!--Circle image View--> 
       <de.hdodenhof.circleimageview.CircleImageView 
         android:layout_width="50dp" 
         android:layout_height="50dp" 
         android:layout_marginLeft="270dp" 
         android:layout_marginTop="220dp" 
         android:id="@+id/circleViewDiscount" 
         android:src="@drawable/border_white"/> 

       <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:text="10.19\nSaturday\n 30th August 2015" 
         android:textSize="23dp" 
         android:textColor="#08ec38" 
         android:id="@+id/textViewPirceTag"/> 
      </LinearLayout> 

      <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:margin_Top="50dp" <!--Style the height--> 
      android:orientation="horizontal"> 
        <!--Add element here--> 
       </LinearLayout> 
      </RelativeLayout>  
     </android.support.v7.widget.CardView>  
    </FrameLayout> 
+1

nhờ ứng dụng: cardPreventCornerOverlap = "false" làm Pleasure lừa – SERG

+1

để giúp @SERG, Và tôi quên nói với bạn cho hình ảnh vòng tròn bạn cần phải biên dịch" biên dịch 'de.hdodenhof: circleimageview: 1.2.1 "trong bảng xếp hạng của bạn – KZoNE

Các vấn đề liên quan