を試してみましたどのようにコードだ
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
showOnClickProfileDialog();
}
private void showOnClickProfileDialog() {
AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this);
View alertView = getLayoutInflater().inflate(R.layout.alert_dialog_view, null);
//Set the view
alert.setView(alertView);
//Show alert
final AlertDialog alertDialog = alert.show();
//Can not close the alert by touching outside.
alertDialog.setCancelable(false);
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
}
これはalert_dialog_view
です
<?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:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/white_radius_background"
android:paddingBottom="150dp"
android:layout_marginTop="150dp"
android:layout_marginRight="15dp"
android:layout_marginLeft="15dp"
android:id="@+id/relativeLayout">
</RelativeLayout>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="-50dp"
android:src="@drawable/profile_picture"
android:layout_alignTop="@+id/relativeLayout"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</RelativeLayout>
これはwhite_radius_background
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="@color/colorWhite50"/>
<corners
android:radius="5dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
これは解決策
ですあなたはそれを四捨五入するために画像を調整する必要があります...しかし、私は、これはあなたのアイデアを与えるだろうと思います。 ![enter image description here](https://i.stack.imgur.com/k4ikN.png)
どういう意味ですか?あなたはイメージを言うが、あなたのXMLにはFABがある –