Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在Imageview下放置按钮_Android_Xml_Android Layout_Android Xml - Fatal编程技术网

Android 如何在Imageview下放置按钮

Android 如何在Imageview下放置按钮,android,xml,android-layout,android-xml,Android,Xml,Android Layout,Android Xml,我使用的布局和结果给出。我希望配置文件图像覆盖3+按钮。如何重新安排布局 请尝试以下代码: CircleImageView profile_image = findViewById(R.id.author_profile_image); profile_image.bringToFront(); 希望这有帮助试试这个 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:l

我使用的布局和结果给出。我希望配置文件图像覆盖3+按钮。如何重新安排布局

请尝试以下代码:

CircleImageView profile_image = findViewById(R.id.author_profile_image);
profile_image.bringToFront();
希望这有帮助

试试这个

<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>

如果您希望图像位于中间,请尝试使用此按钮。您可以使用android:layout\u centerHorizontal=true而不是android:layout\u alignParentStart=true。尝试过但没有效果:只需在btn\u more\u author的下方放置作者配置文件\u图像。
CircleImageView profile_image = findViewById(R.id.author_profile_image);
profile_image.bringToFront();
<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>