In my app I use many dialogs (popups) and I want to give them a rounded corner shape.
The way I create these popups is this:
On java code I create a function like this:
private void showpopup(){
dialog = new Dialog(this);
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(getLayoutInflater().inflate(R.layout.popup, null));
dialog.setCancelable(false);
TextView fin = (TextView) dialog.findViewById(R.id.solu);
fin.setText("¡¡safsfasfsafs!!");
fin.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
}
The layout I call there is created in this way:
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
>
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape"
android:orientation="vertical"
android:padding="10dp"
>
<TextView
android:id="@+id/solu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25sp"
android:padding="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
</LinearLayout>
and finally, the xml "shape" that I call in the background is this:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="20dp"/>
<stroke
android:width="1dp"
android:color="@color/black"/>
</shape>
The result it's something like this:
As you can see, I don't achieve what I want...