2017-01-11 1 views

Répondre

5

simplement vous pouvez utiliser RealtiveLayout et des marges négatives

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/activity_landing" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/screen_background"> 


    <ImageView 
     android:background="@color/black" 
     android:id="@+id/img_background" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:src="@mipmap/ic_launcher" /> 

    <ImageView 
     android:layout_width="80dp" 
     android:layout_height="80dp" 
     android:layout_below="@+id/img_background" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="-40dp"<!-- negative margin to half of height --> 
     android:src="@mipmap/ic_launcher" /> 

</RelativeLayout> 
0

Ceci peut être réalisé facilement par RelativeLayout mais vous devez regarder environ CoordinatorLayout et ses caractéristiques.

+0

de bien vouloir donne moi un petit exemple .. J'ai utilisé relativeLayout bt son image complète qui se chevauchent .. je vouloir chevaucher la moitié – Asad

+0

une approche est donner une marge supérieure largerImageSize- (smallImageSize/2) à l'image circulaire – Spartan

0

Vous devez définir la marge supérieure avec moins (-) values.It chevauche votre point de vue de l'image avec d'autres

0
<RelativeLayout 
       android:layout_width="@dimen/_90sdp" 
       android:layout_height="@dimen/_90sdp"> 

       <ImageView 
        android:id="@+id/bg" 
        android:layout_width="match_parent" 
        android:layout_height="@dimen/_90sdp" 
        android:background="@color/profile_bg" 
        android:scaleType="fitXY" /> 

       <ImageView 
        android:id="@+id/img_user" 
        android:layout_width="@dimen/_80sdp" 
        android:layout_height="@dimen/_80sdp" 
        android:layout_below="@+id/bg" 
        android:layout_centerHorizontal="true" 
        android:layout_marginTop="@dimen/_minus50sdp" 
        android:src="@drawable/place_holder_profile"/> 
    </RelativeLayout> 

Utilisez cette dépendances compilent « com.intuit.sdp: sdp-android: 1.0. 2' https://github.com/intuit/sdp

0

Le FrameLayout est plus optimisé pour effectuer cette fonction. Je porte moins de frais généraux.

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/activity_landing" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    > 


    <ImageView 
     android:id="@+id/img_background" 
     android:layout_width="match_parent" 
     android:layout_height="500dp" 
     android:src="@mipmap/ic_launcher" 
     android:background="@color/colorPrimary"/> 

    <ImageView 
     android:layout_width="160dp" 
     android:layout_height="160dp" 
     android:layout_below="@+id/img_background" 
     android:layout_gravity="bottom|center_horizontal" 
     android:src="@mipmap/ic_launcher" 
     android:background="@color/cardview_dark_background"/> 

</FrameLayout> 
0

essayer, il ressemble à ce enter image description here

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_weight="1"> 

      <de.hdodenhof.circleimageview.CircleImageView 
       android:id="@+id/profile_image" 
       android:layout_width="96dp" 
       android:layout_height="96dp" 
       android:src="@drawable/cc" 
       app:civ_border_width="2dp" 
       app:civ_border_color="#FF000000" 
       android:layout_centerInParent="true" 
       /> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical"> 

       <FrameLayout 
        android:layout_width="match_parent" 
        android:layout_height="0dp" 
        android:layout_weight="1"> 
        <ImageView 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:alpha="0.4" 
         android:src="@drawable/a123123t"/> 

       </FrameLayout> 

       <FrameLayout 
        android:layout_width="match_parent" 
        android:layout_height="0dp" 
        android:layout_weight="1"> 
        <!--blank space--> 

       </FrameLayout> 


      </LinearLayout> 

     </RelativeLayout> 
     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_weight="1" 
      android:orientation="vertical"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="0dp" 
       android:layout_weight="1" 
       android:orientation="horizontal"> 
       <FrameLayout 
        android:layout_width="0dp" 
        android:layout_weight="1" 
        android:layout_height="match_parent"> 
        <de.hdodenhof.circleimageview.CircleImageView 
         android:id="@+id/profile_image1" 
         android:layout_width="96dp" 
         android:layout_height="96dp" 
         android:src="@drawable/cc" 
         android:padding="8dp" 
         android:layout_gravity="center" 
         app:civ_border_width="2dp" 
         app:civ_border_color="#FF000000" 
         android:layout_centerInParent="true" 
         /> 

       </FrameLayout> 

       <FrameLayout 
        android:layout_width="0dp" 
        android:layout_weight="1" 
        android:layout_height="match_parent"> 
        <de.hdodenhof.circleimageview.CircleImageView 
         android:id="@+id/profile_image2" 
         android:layout_width="96dp" 
         android:layout_height="96dp" 
         android:src="@drawable/cc" 
         android:padding="8dp" 
         android:layout_gravity="center" 
         app:civ_border_width="2dp" 
         app:civ_border_color="#FF000000" 
         android:layout_centerInParent="true" 
         /> 

       </FrameLayout> 

       <FrameLayout 
        android:layout_width="0dp" 
        android:layout_weight="1" 
        android:layout_height="match_parent"> 

        <de.hdodenhof.circleimageview.CircleImageView 
         android:id="@+id/profile_image3" 
         android:layout_width="96dp" 
         android:layout_height="96dp" 
         android:src="@drawable/cc" 
         android:padding="8dp" 
         android:layout_gravity="center" 
         app:civ_border_width="2dp" 
         app:civ_border_color="#FF000000" 
         android:layout_centerInParent="true" 
         /> 
       </FrameLayout> 






      </LinearLayout> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="0dp" 
       android:layout_weight="1" 
       android:orientation="vertical"> 

       <android.support.v4.widget.Space 
        android:layout_width="match_parent" 
        android:layout_height="0dp" 
        android:layout_weight="1" /> 

       <Button 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:text="Edit Profile"/> 
      </LinearLayout> 

     </LinearLayout> 



    </LinearLayout> 

</LinearLayout> 

pour les dépendances:

'Compile de.hdodenhof: circleimageview: 2.1.0'