下图是我想将其设计为自定义对话框布局,我的问题是:我无法将圆形 ImageView 作为对话框图标放在布局之上
我的布局 xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_gravity="center">
<ir.pishguy.signalpresentationproject.Widgets.CircularRevealView
android:id="@+id/reveal"
android:layout_width="match_parent"
android:layout_height="350dp"
android:layout_gravity="center"/>
<FrameLayout
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="55dp"
android:layout_height="55dp"
android:src="@drawable/ic_messages"
app:civ_border_color="#ffffff"
app:civ_border_width="5dp"
android:layout_marginTop="-35dp"
android:id="@+id/store_avatar"
android:layout_gravity="top"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="New Text"/>
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="New Text"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
</FrameLayout>
</FrameLayout>
我的布局截图:
最佳答案
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@android:color/transparent">
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginTop="55dp"
android:background="@android:color/holo_blue_dark"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="60dp"
android:text="@string/app_name"
android:textColor="@android:color/black"
android:textSize="22sp"
android:textStyle="bold" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:background="@android:color/white"
android:gravity="center"
android:text="Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! "
android:textColor="@android:color/black"
android:textSize="18sp" />
<Button
android:id="@+id/alert_btn_cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:background="#FF00F5"
android:text="Done"
android:textColor="@android:color/white"
android:textSize="18sp" />
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@mipmap/ic_launcher" />
</RelativeLayout>
关于Android 设计图标化自定义对话框布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37879036/