Reputation: 304
The layout I used and the result is given. I want the profile Image to overlay the 3+ button. How can I rearrange the layout ?
<RelativeLayout
android:id="@+id/profile_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/author_profile_image"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:src="@drawable/ic_account_circle">
</de.hdodenhof.circleimageview.CircleImageView>
<Button
android:id="@+id/btn_more_author"
android:visibility="visible"
android:layout_width="40dp"
android:layout_height="38dp"
android:layout_centerVertical="true"
android:layout_marginLeft="-10dp"
android:layout_toRightOf="@+id/author_profile_image"
android:background="@drawable/round_button"
android:text="3+"
android:textColor="#fff"
android:textStyle="bold" />
</RelativeLayout>
Upvotes: 0
Views: 1529
Reputation: 376
Try this
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/_10sdp"
android:layout_marginTop="@dimen/_10sdp"
android:orientation="horizontal">
<TextView
android:id="@+id/cup_edit_image"
android:layout_width="40dp"
android:layout_height="38dp"
android:layout_gravity="center"
android:layout_marginLeft="50dp"
android:layout_marginRight="-70dp"
android:background="@drawable/btn_round"
android:gravity="center"
android:padding="@dimen/_5sdp"
android:src="@drawable/btn_round"
android:text="3+"
android:textColor="#fff" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/cup_user_profile"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:src="@drawable/ic_userprofile_placeholder" />
</LinearLayout>
Upvotes: 1
Reputation: 113
Try this code:
CircleImageView profile_image = findViewById(R.id.author_profile_image);
profile_image.bringToFront();
Hope this helps
Upvotes: 0
Reputation: 1061
<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/profile_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_alignParentStart="true"
android:id="@+id/profile_layout"
android:layout_width="wrap_content"
android:orientation="horizontal"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/author_profile_image"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:src="@drawable/ic_account_circle">
</de.hdodenhof.circleimageview.CircleImageView>
<Button
android:id="@+id/btn_more_author"
android:visibility="visible"
android:layout_width="40dp"
android:layout_height="38dp"
android:layout_centerVertical="true"
android:layout_marginLeft="-10dp"
android:layout_toRightOf="@+id/author_profile_image"
android:background="@drawable/round_button"
android:text="3+"
android:textColor="#fff"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
Upvotes: 0