2016-08-19 5 views
0

이 기능의 적절한 이름을 모릅니다. 여기에 내 문제를 더 잘 이해하는 이미지가 있습니다. 안드로이드에서 다른 하단의 끈적한 이미지

enter image description here

I 프로필 이미지가 큰 이미지 하단에 같은 다른 이미지의 테두리 하단에 이미지의 레이아웃을 만들 필요.

저는이 두 이미지가 포함 된 CardView를 사용하고 있습니다. 내 코드 :

<android.support.v7.widget.CardView 
      android:id="@+id/cardview" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:elevation="100dp" 
      card_view:cardCornerRadius="8dp" 
      card_view:useCompatPadding="true" 
      card_view:cardPreventCornerOverlap="false" 
      > 
       <ImageView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:src="@drawable/bigImage" 
        /> 
       <ImageView 
        android:layout_width="10dp" 
        android:layout_height="10dp" 
        android:src="@drawable/smallImage" 
        /> 
     </android.support.v7.widget.CardView> 

이 하나가 이것 좀 도와 줄래?

답변

0

이것은 고정 된 높이의 이미지로 또는 프로그래밍 방식으로 계산됩니다.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 

     <RelativeLayout 
      android:id="@+id/layoutTop" 
      android:layout_width="match_parent" 
      android:layout_height="200dp" > 
     </RelativeLayout> 

     <RelativeLayout 
      android:id="@+id/layoutBottom" 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_alignParentBottom="true" 
      android:layout_below="@id/layoutTop" > 
     </RelativeLayout> 

     <ImageView 
      android:id="@+id/overlapImage" 
      android:layout_width="wrap_content" 
      android:layout_height="40dp" 
      android:layout_above="@id/layoutBottom" 
      android:layout_centerHorizontal="true" 
      android:layout_marginBottom="-20dp" <!-- This should be always half the height, can also be calculated and added programtically --> 
      android:adjustViewBounds="true" 
      android:src="@drawable/ic_launcher" /> 

    </RelativeLayout> 
+0

실례가 있습니까? 나를 위해 작동하지 않습니다. – Atula

+0

나는 이것에 지적했다. 이것을보십시오 - http://stackoverflow.com/questions/25127468/android-placing-imageview-on-overlap-between-layouts –

관련 문제