Listo
Listo

Reputation: 179

android imageview background

I need to hide the extra transparent background for the camera icon that is visible beyond profile pic.

UPDATED IMAGE FOR BETTER UNDERSTANDING MY ISSUE

Here is the XML code that I used.

How can I achieve this

 <FrameLayout
        android:id="@+id/profile"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center"
        android:layout_marginTop="12dp">

        <de.hdodenhof.circleimageview.CircleImageView

            android:id="@+id/ivProfilePic"
            android:layout_width="96dp"
            android:layout_height="96dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_gravity="center"
            android:src="@drawable/girl_sample_picture" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#60000000"
            android:layout_gravity="bottom|center">

            <de.hdodenhof.circleimageview.CircleImageView
                android:id="@+id/ivCameraChangeProfilePic"
                android:layout_width="match_parent"
                android:layout_height="36dp"
                android:layout_gravity="center"
                android:src="@android:drawable/ic_menu_camera" />
        </LinearLayout>
    </FrameLayout>

Upvotes: 1

Views: 166

Answers (3)

Listo
Listo

Reputation: 179

Thanks for the response , By considering all the above suggestions, I solved it myself by using android:background="#60012b73"

   <FrameLayout
        android:id="@+id/profile"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center"
        android:layout_marginTop="12dp">

        <de.hdodenhof.circleimageview.CircleImageView

            android:id="@+id/ivProfilePic"
            android:layout_width="96dp"
            android:layout_height="96dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_gravity="center"
            android:src="@drawable/girl_sample_picture" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#60012b73"
            android:layout_gravity="bottom|center">

            <de.hdodenhof.circleimageview.CircleImageView
                android:id="@+id/ivCameraChangeProfilePic"
                android:layout_width="match_parent"
                android:layout_height="36dp"
                android:layout_gravity="center"
                android:src="@drawable/camera_icon" />
        </LinearLayout>
    </FrameLayout>

Upvotes: 0

Chetan Joshi
Chetan Joshi

Reputation: 5711

Below is Transparent code list with percentage . you can add with any color like below for your case use below color code to your LienarLayout and try with other prefix .

#80000000

100% — FF
95% — F2
90% — E6
85% — D9
80% — CC
75% — BF
70% — B3
65% — A6
60% — 99
55% — 8C
50% — 80
45% — 73
40% — 66
35% — 59
30% — 4D
25% — 40
20% — 33
15% — 26
10% — 1A
5% — 0D
0% — 00

Upvotes: 1

Shanto George
Shanto George

Reputation: 994

Please Try this

<FrameLayout
            android:id="@+id/profile"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_centerHorizontal="true"
            android:layout_gravity="center"
            android:layout_marginTop="12dp">

            <de.hdodenhof.circleimageview.CircleImageView

                android:id="@+id/ivProfilePic"
                android:layout_width="96dp"
                android:layout_height="96dp"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:layout_gravity="center"
                android:src="@drawable/girl_sample_picture" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#00000000"
                android:layout_gravity="bottom|center">

                <de.hdodenhof.circleimageview.CircleImageView
                    android:id="@+id/ivCameraChangeProfilePic"
                    android:layout_width="wrap_content"
                    android:layout_height="36dp"
                    android:layout_gravity="center"
                    android:src="@android:drawable/ic_menu_camera" />
            </LinearLayout>
        </FrameLayout>

Upvotes: 0

Related Questions