When I want to make a% custom_comment I just put a layout inside it. But around%% is square, does anyone know how to round it?
When I want to make a% custom_comment I just put a layout inside it. But around%% is square, does anyone know how to round it?
Here's an example:
Java :
Dialog dialog = new Dialog(this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.setContentView(R.layout.dialog_layout);
dialog_layout.xml :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/rounded_box"
android:layout_gravity="center”>
</RelativeLayout>
drawable / rounded_box.xml :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color=“#FFFFFF" />
<corners android:radius=“5dp" />
</shape>
I think changing the theme can help you, just that you will need to manually configure some of your alertDialog's size information, arrange a layout to be the base of your xml, and center what you want in the size you want , and in your code where you create the Builder of the alertDialog theme as a parameter:
new AlertDialog.Builder(context, android.R.style.Theme_Translucent_NoTitleBar);
Note that this will leave your alert dialog transparent, to leave the rounded corners simply put an image with rounded corners and that has transparency and finally set as background of your layout.