답변

0

BASIC

CardView는 이미지 뷰보다 높은 고도를 가지고있다. 따라서 ImageView의 높이를 으로 설정하십시오. 여기 우리가 간다

..

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context=".activity.Splash" 
    tools:showIn="@layout/activity_splash" 
    > 


    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

    <android.support.v7.widget.CardView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:cardUseCompatPadding="true" 
     android:elevation="5dp" 
     android:stateListAnimator="@anim/button_elevation" 
     android:id="@+id/one" 
     android:layout_marginLeft="@dimen/activity_horizontal_margin" 
     > 

     <RelativeLayout 
      android:orientation="vertical" android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:padding="@dimen/activity_horizontal_margin" 
      android:background="?attr/selectableItemBackground" 

      > 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="this is just for test" 
       /> 

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


     <ImageView 
      android:layout_marginRight="@dimen/activity_horizontal_margin" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/cross" 
      android:id="@+id/two" 
      android:layout_centerVertical="true" 
      android:elevation="10dp" 
      /> 

</RelativeLayout> 
</RelativeLayout> 

그리고 스크린 샷 ....

enter image description here

+0

잘 시도해보세요. 그러나 이것이 작동하지 않는 마지막 이미지에서 표고를 제거하십시오 - @AndroidHacker –

+0

해결책이 효과가 없었습니까? Very 놀라운. – AndroidHacker