2017-12-07 3 views
0

Ich versuche ImageView zu verankern Layout wie untenWie Image zu verankern Layout

enter image description here

Wir FloatingActionButton verankern können, aber, wie man anchor ein Imageview

Ich bin nicht CoordinatorLayout verwenden. Ich verwende LinearLayout

Wie kann ich das tun

+1

Sie leicht verankern können, wenn Sie –

+1

'LinearLayout' nicht über Anker use'ConstraintLayout' würde. –

+0

Sie können dies durch relatives Layout erreichen –

Antwort

1

Versuchen Sie, diese

<?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:id="@+id/activity_account_detail" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <View 
     android:id="@+id/view" 
     android:layout_width="match_parent" 
     android:layout_height="200dp" 
     android:layout_alignParentStart="true" 
     android:layout_alignParentTop="true" 
     android:background="@color/colorPrimary" /> 

    <ScrollView 
     android:id="@+id/scrolView_account" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 


     <RelativeLayout 
      android:id="@+id/linear_account" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical"> 

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


       <android.support.v7.widget.CardView 
        android:id="@+id/cardView_account_details" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:layout_marginTop="70dp" 
        app:cardCornerRadius="5dp" 
        app:cardElevation="5dp" 
        app:cardUseCompatPadding="true"> 


        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:background="@color/colorAccent" 
         android:orientation="vertical"> 


         <LinearLayout 
          android:id="@+id/linear_account_input_details" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:layout_marginTop="50dp" 
          android:orientation="vertical" 
          android:padding="10dp"> 

          <TextView 
           android:layout_width="match_parent" 
           android:layout_height="wrap_content" 
           android:layout_marginTop="20dp" 
           android:gravity="center" 
           android:text="NILU" 
           android:textSize="30sp" /> 

          <EditText 
           android:layout_width="match_parent" 
           android:layout_height="wrap_content" 
           android:drawableLeft="@mipmap/ic_launcher_round" 
           android:hint="Enter Email" /> 

          <EditText 
           android:layout_width="match_parent" 
           android:layout_height="wrap_content" 
           android:drawableLeft="@mipmap/ic_launcher_round" 
           android:hint="Enter Paasword" /> 


          <Button 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:layout_gravity="center" 

           android:text="Login" /> 

         </LinearLayout> 

        </LinearLayout> 

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

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:text="This is demo" /> 

      </LinearLayout> 

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

       <de.hdodenhof.circleimageview.CircleImageView 
        android:id="@+id/imageview_account_profile" 
        android:layout_width="150dp" 
        android:layout_height="150dp" 
        android:layout_alignParentTop="true" 
        android:layout_centerHorizontal="true" 
        android:src="@mipmap/ic_launcher_round" 
        app:civ_border_color="@color/colorWhite" 
        app:civ_border_width="2dp" /> 

      </RelativeLayout> 

     </RelativeLayout> 


    </ScrollView> 


</RelativeLayout> 
Verwandte Themen