<legend id='HXH6H'><style id='HXH6H'><dir id='HXH6H'><q id='HXH6H'></q></dir></style></legend>

    <i id='HXH6H'><tr id='HXH6H'><dt id='HXH6H'><q id='HXH6H'><span id='HXH6H'><b id='HXH6H'><form id='HXH6H'><ins id='HXH6H'></ins><ul id='HXH6H'></ul><sub id='HXH6H'></sub></form><legend id='HXH6H'></legend><bdo id='HXH6H'><pre id='HXH6H'><center id='HXH6H'></center></pre></bdo></b><th id='HXH6H'></th></span></q></dt></tr></i><div id='HXH6H'><tfoot id='HXH6H'></tfoot><dl id='HXH6H'><fieldset id='HXH6H'></fieldset></dl></div>

      <small id='HXH6H'></small><noframes id='HXH6H'>

      • <bdo id='HXH6H'></bdo><ul id='HXH6H'></ul>
    1. <tfoot id='HXH6H'></tfoot>

      如何为自定义对话框添加标题?

      时间:2023-08-30

    2. <legend id='5L4aK'><style id='5L4aK'><dir id='5L4aK'><q id='5L4aK'></q></dir></style></legend>
    3. <tfoot id='5L4aK'></tfoot>

      <small id='5L4aK'></small><noframes id='5L4aK'>

        <i id='5L4aK'><tr id='5L4aK'><dt id='5L4aK'><q id='5L4aK'><span id='5L4aK'><b id='5L4aK'><form id='5L4aK'><ins id='5L4aK'></ins><ul id='5L4aK'></ul><sub id='5L4aK'></sub></form><legend id='5L4aK'></legend><bdo id='5L4aK'><pre id='5L4aK'><center id='5L4aK'></center></pre></bdo></b><th id='5L4aK'></th></span></q></dt></tr></i><div id='5L4aK'><tfoot id='5L4aK'></tfoot><dl id='5L4aK'><fieldset id='5L4aK'></fieldset></dl></div>
          <tbody id='5L4aK'></tbody>
            <bdo id='5L4aK'></bdo><ul id='5L4aK'></ul>
                本文介绍了如何为自定义对话框添加标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                如何为这个自定义对话框添加标题??

                How can i add title to this custom dialog??

                我试过这样

                public void customDialog()
                 {
                  Dialog dialog=new Dialog(this);
                  dialog.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
                  dialog.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.string.app_name );
                  dialog.setContentView(R.layout.dialog_submit);
                  TextView edit_model=(TextView) dialog.findViewById(R.id.edit_model);
                  edit_model.setText(android.os.Build.DEVICE);
                  dialog.show();
                 }//end of custom dialog function
                

                我也尝试过这样设置标题..dialog.setTitle("Enter Details"); 但这也没有产生任何结果.那么如何设置这个自定义对话框的标题呢?

                I have tried to set title like this too..dialog.setTitle("Enter Details"); but this too didn't yielded any result. So how can i set title to this custom dialog??

                这是我用于自定义对话框的 dialog_submit.xml 文件.

                This is my dialog_submit.xml file used for the custom dialog.

                 <?xml version="1.0" encoding="utf-8"?>
                <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                          android:id="@+id/layout_root"
                          android:orientation="vertical" 
                          android:layout_width="fill_parent"
                          android:layout_height="fill_parent"
                          android:padding="10dp"
                          >
                  <TextView android:id="@+id/txt_name"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:textColor="#FFF"
                          android:text="Name"
                          android:textStyle="bold"
                          />
                  <EditText android:id="@+id/edit_name"
                          android:layout_width="fill_parent"
                          android:layout_height="wrap_content"
                          android:layout_below="@+id/txt_name"
                          />
                <TextView android:id="@+id/txt_model"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:textColor="#FFF"
                          android:layout_below="@+id/edit_name"
                          android:text="Phone Model"
                          />
                <TextView android:id="@+id/edit_model"
                          android:layout_width="fill_parent"
                          android:layout_height="wrap_content"
                          android:layout_below="@+id/txt_model"
                          />
                
                <Button android:id="@+id/but_cancel"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_below="@+id/edit_model"
                          android:text="Cancel"     
                          />
                <Button android:id="@+id/but_submit"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_below="@+id/edit_model"
                          android:layout_toRightOf="@+id/but_cancel"    
                          android:text="Submit"     
                          />                       
                </RelativeLayout>
                

                推荐答案

                使用你的一些片段:

                public void customDialog() {
                    Dialog dialog=new Dialog(this);
                    dialog.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
                    dialog.setContentView(R.layout.dialog_submit);
                    dialog.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
                    dialog.show();
                }
                

                res/layout/custom_title.xml

                res/layout/custom_title.xml

                <TextView xmlns:android="http://schemas.android.com/apk/res/android"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="This is a custom title"/>
                

                这篇关于如何为自定义对话框添加标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何更改 ListPreference 对话框的外观 下一篇:将 android 活动定义为带有浅色主题的对话框

                相关文章

                最新文章

              1. <tfoot id='ElpyV'></tfoot>
                    <legend id='ElpyV'><style id='ElpyV'><dir id='ElpyV'><q id='ElpyV'></q></dir></style></legend>

                    <small id='ElpyV'></small><noframes id='ElpyV'>

                    <i id='ElpyV'><tr id='ElpyV'><dt id='ElpyV'><q id='ElpyV'><span id='ElpyV'><b id='ElpyV'><form id='ElpyV'><ins id='ElpyV'></ins><ul id='ElpyV'></ul><sub id='ElpyV'></sub></form><legend id='ElpyV'></legend><bdo id='ElpyV'><pre id='ElpyV'><center id='ElpyV'></center></pre></bdo></b><th id='ElpyV'></th></span></q></dt></tr></i><div id='ElpyV'><tfoot id='ElpyV'></tfoot><dl id='ElpyV'><fieldset id='ElpyV'></fieldset></dl></div>
                    • <bdo id='ElpyV'></bdo><ul id='ElpyV'></ul>