久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <bdo id='Fldkz'></bdo><ul id='Fldkz'></ul>
  1. <i id='Fldkz'><tr id='Fldkz'><dt id='Fldkz'><q id='Fldkz'><span id='Fldkz'><b id='Fldkz'><form id='Fldkz'><ins id='Fldkz'></ins><ul id='Fldkz'></ul><sub id='Fldkz'></sub></form><legend id='Fldkz'></legend><bdo id='Fldkz'><pre id='Fldkz'><center id='Fldkz'></center></pre></bdo></b><th id='Fldkz'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Fldkz'><tfoot id='Fldkz'></tfoot><dl id='Fldkz'><fieldset id='Fldkz'></fieldset></dl></div>
  2. <legend id='Fldkz'><style id='Fldkz'><dir id='Fldkz'><q id='Fldkz'></q></dir></style></legend>
    1. <tfoot id='Fldkz'></tfoot>

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

      Android 在警報對話框中設置文本

      Android Set text in alert dialog(Android 在警報對話框中設置文本)
      <tfoot id='nHdkq'></tfoot>

          <tbody id='nHdkq'></tbody>
        • <small id='nHdkq'></small><noframes id='nHdkq'>

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

            • <bdo id='nHdkq'></bdo><ul id='nHdkq'></ul>
            • <legend id='nHdkq'><style id='nHdkq'><dir id='nHdkq'><q id='nHdkq'></q></dir></style></legend>

                本文介紹了Android 在警報對話框中設置文本的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在嘗試創建一個警報對話框,頂部有一個圖像標題,底部有 2 個按鈕,我想通過代碼在中間設置文本.但是,我無法在橫幅下方設置文本.我想創建類似于 this link 上的內容.但是,文本總是在圖像上方結束,因為我不知道如何在對話框構建器中引用文本視圖.謝謝

                I'm trying to create an alert dialog with an image header across the top, 2 buttons at the bottom and I want to set the text in the middle from code. However, I can't get the set text underneath the banner. I want to create something similar to the one on this link. However, the text always ends up above the image as I don't know how to reference the textview in the dialog builder. Thanks

                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                    LayoutInflater inflater = getLayoutInflater();
                
                    builder.setView(inflater.inflate(R.layout.custom_dialog, null))
                           .setMessage("Message" + message)
                           .setPositiveButton("Share", new DialogInterface.OnClickListener() {
                               public void onClick(DialogInterface dialog, int id) {
                                   if (isNetworkAvailable()) {
                                        if (...) {...} 
                                        else {...}
                                   } else {...} 
                               }  
                           })
                           .setNegativeButton("Shake again!", new DialogInterface.OnClickListener() {
                               public void onClick(DialogInterface dialog, int id) {
                                   // User cancelled the dialog
                               }
                           })
                           .setOnCancelListener(new OnCancelListener() {
                                @Override
                                public void onCancel(DialogInterface dialog) {}
                           });
                
                    AlertDialog alert = builder.create();
                
                    alert.setOnDismissListener(new OnDismissListener() {
                        @Override
                        public void onDismiss(DialogInterface dialog) {}
                    });
                
                    alert.show();
                

                布局xml文件為:

                <?xml version="1.0" encoding="utf-8"?>
                <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:orientation="vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content">
                
                <ImageView
                    android:src="@drawable/yo3"
                    android:layout_width="match_parent"
                    android:layout_height="64dp"
                    android:scaleType="center"
                    android:background="#FFFFBB33"
                    android:contentDescription="@string/app_name" />
                
                <TextView
                    android:id="@+id/dialogtext"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>
                
                </LinearLayout>`
                

                推薦答案

                不要用你的方式設置消息.

                Don't set the message with the way you do it.

                在您的自定義布局中,您必須設置的 textview 是dialogtext"TextView.試試這個……看看我得到了我膨脹的自定義視圖,從那個視圖中我得到了自定義對話框(你之前實際上沒有設置)并設置消息在構建發生后顯示.實際上,您可以擁有任何您想要的自定義視圖,并根據自己的喜好設置視圖的每個元素,甚至可以處理其上的事件

                In your custom layout the textview you have to set is the "dialogtext" TextView. Try this...see that i get the custom view that i inflate and from that view i get the custom dialog (which you didn't actualy set before) and set the message to show after the build has taken place. Actually you can have whatever custom view you want and set each element of the view as you prefer or even handle events on it

                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                LayoutInflater inflater = getLayoutInflater();
                
                View customView = inflater.inflate(R.layout.custom_dialog, null);
                TextView messageView = (TextView)customView.findViewById(R.id.dialogtext);
                
                
                builder.setView(customView)
                        .setPositiveButton("Share", new DialogInterface.OnClickListener() {
                           public void onClick(DialogInterface dialog, int id) {
                
                               if (isNetworkAvailable()){
                
                                    if (......;
                
                                    } else {
                                        ......
                                    }
                
                               } else {
                                   .......;
                               }    
                           }  
                       })
                       .setNegativeButton("Shake again!", new DialogInterface.OnClickListener() {
                           public void onClick(DialogInterface dialog, int id) {
                               // User cancelled the dialog
                
                           }
                
                    }).setOnCancelListener(new OnCancelListener() {
                
                        @Override
                        public void onCancel(DialogInterface dialog) {
                
                        }
                    });
                
                messageView.SetText("Message" + message);
                
                
                
                AlertDialog alert = builder.create();
                
                alert.setOnDismissListener(new OnDismissListener() {
                
                    @Override
                    public void onDismiss(DialogInterface dialog) {
                
                
                    }
                });
                alert.show();
                

                這篇關于Android 在警報對話框中設置文本的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網絡提供商)
                Get current location during app launch(在應用啟動期間獲取當前位置)
                locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)

                    <tbody id='A3NR2'></tbody>
                1. <tfoot id='A3NR2'></tfoot>

                    • <bdo id='A3NR2'></bdo><ul id='A3NR2'></ul>

                      • <small id='A3NR2'></small><noframes id='A3NR2'>

                      • <legend id='A3NR2'><style id='A3NR2'><dir id='A3NR2'><q id='A3NR2'></q></dir></style></legend>

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

                          主站蜘蛛池模板: 亚洲精品电影在线观看 | 欧美性生交大片免费 | 免费在线成人 | 亚洲最大成人综合 | 国产一区日韩在线 | 交专区videossex农村 | 天天影视综合 | 国产福利久久 | 欧美一级二级视频 | 激情毛片| 久久久久久亚洲国产精品 | 91精品国产91久久久久久吃药 | 国产一区二区自拍 | 亚洲免费在线 | 91精品91久久久 | 99久久婷婷 | h视频免费看| 国产在线网站 | 91视频在线| 日韩精品人成在线播放 | 欧美乱大交xxxxx另类电影 | 国产精品久久久久久久久久 | 97免费在线视频 | 亚洲综合大片69999 | 亚洲成人一区二区 | 日本不卡一区二区三区在线观看 | 91久久国产综合久久91精品网站 | 成人一级视频在线观看 | 久草精品视频 | 国产精品久久久久久久久久久新郎 | 亚洲欧洲一区 | 日本黄色短片 | 亚洲一区二区三区在线视频 | 免费一区二区三区 | 97精品国产97久久久久久免费 | 岛国在线免费观看 | 欧美一区中文字幕 | 久久精品国产99国产精品 | 日韩中文一区二区三区 | 日韩欧美国产一区二区 | 成人午夜精品 |