如何使自定义对话框成角度边缘

时间:2012-02-18 10:12:06

标签: android dialog customdialog

当我创建自定义对话框时,它看起来像这样:
dialog

但我希望它看起来像这样:
dialog

5 个答案:

答案 0 :(得分:1)

创建一个扩展Dialog并将其扩展为布局的类

public class CustomDialog extends Dialog
    {
        public CustomDialog (Context context)
        {
            //use this Theme, or any other theme you like
            super(context, android.R.style.Theme_Translucent_NoTitleBar);

            requestWindowFeature(Window.FEATURE_NO_TITLE);

            setContentView(R.layout.your_layout);
        }
    }

答案 1 :(得分:1)

您可以使用自定义对话框并将设计的xml充气到其中。

final Dialog yourDialog=new Dialog(context);
thumbnail_click.setContentView(R.layout.yourlayout);

答案 2 :(得分:0)

您可以使用自己的自定义布局进行对话,如以下链接

Custom dialog

Custom Dialog PoPup

答案 3 :(得分:0)

您始终可以充气您自己的自定义对话框布局。

LayoutInflater inflater = getLayoutInflater();
View dialoglayout = inflater.inflate(R.layout.dialog_layout, (ViewGroup)     findViewById(R.id.dialog_layout_root));
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(dialoglayout);

答案 4 :(得分:0)

如果你还没有得到答案,这是一个很好的教程:Toturial

您需要制作自己的XML形状样式文件,并使用角落函数ex:

<corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" />
相关问题