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

    <bdo id='so3ko'></bdo><ul id='so3ko'></ul>
    1. <small id='so3ko'></small><noframes id='so3ko'>

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

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

        自定義對話框上的 Admob 廣告

        Admob ad on custom Dialog(自定義對話框上的 Admob 廣告)

          <tbody id='BKP4h'></tbody>

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

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

                • <bdo id='BKP4h'></bdo><ul id='BKP4h'></ul>
                • <tfoot id='BKP4h'></tfoot>
                  本文介紹了自定義對話框上的 Admob 廣告的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試在應用上實施 Admob 廣告.我想要做的是在自定義對話框上投放橫幅廣告.我已經嘗試了所有方法,但找不到解決方案.

                  I am trying to implement Admob ads on app. What I want to do is to ad a banner ad on a custom Dialog. I have tried everything but can't find the solution.

                  我為對話框制作了一個自定義 xml.在xml上添加admob時,它不會運行.所以我嘗試以編程方式進行.但仍然無法使其工作.

                  I have made a custom xml for the dialog. When adding admob on xml, it won't run. So I tried do it programmatically. But still can't make it work.

                  public void OnClickButton(View paramView)
                    {
                      int btn_id = paramView.getId();
                  
                         if (btn_id == R.id.hint_field)
                         {
                       //set up dialog
                             if (hint != null && hint.length()>0) {
                            final Dialog dialog = new Dialog(Activity.this);
                            dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
                  
                            //ad loading
                            dialog.setContentView(R.layout.custom_dialog);
                            RelativeLayout layout = (RelativeLayout)findViewById(R.id.dialog_l);
                            layout.addView(ad);
                            AdRequest r = new AdRequest();
                            ad.loadAd(r);
                  
                            dialog.setTitle("Σχετικ? με την λ?ξη :");
                            dialog.setCancelable(true);
                  
                             //set up text
                            TextView text = (TextView) dialog.findViewById(R.id.hint_text);
                            text.setText(hint);
                  
                  
                  
                           //set up button
                             Button button = (Button) dialog.findViewById(R.id.Button01);
                             button.setOnClickListener(new OnClickListener() {
                             public void onClick(View v) {
                                     dialog.dismiss();
                                }
                            });
                  
                            // now that the dialog is set up, it's time to show it    
                             dialog.show();
                             dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_launcher);
                       }
                     }   
                  

                  單擊按鈕時,我會顯示一個自定義對話框.在我的 Activity 的 OnCreate 方法中,我制作了 adView

                  On a button click I display a custom Dialog. In the OnCreate method of my Activity I have made the adView

                    AdView  ad = new AdView(this, AdSize.BANNER, "a15xxxxxxxxxxx");
                  

                  我在:layout.addView(ad); 處得到 NullPointerException;

                  I get a NullPointerException at : layout.addView(ad);

                  有什么想法嗎?

                  提前致謝!

                  推薦答案

                  問題解決了!我必須先給自定義對話框界面充氣.下面的代碼是工作代碼!

                  Problem solved! I had to inflate the custom dialog interface first. The code below is the working code!

                   public void OnClickButton(View paramView)
                    {
                      int btn_id = paramView.getId();
                  
                         if (btn_id == R.id.hint_field)
                         {
                       //set up dialog
                             if (hint != null && hint.length()>0) {
                            final Dialog dialog = new Dialog(Activity.this, R.style.Theme_New);
                            dialog.requestWindowFeature(Window.FEATURE_LEFT_ICON);
                            dialog.setContentView(R.layout.custom_dialog);
                  
                            LayoutInflater inflater =(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                            View main = inflater.inflate(R.layout.custom_dialog, null);
                            dialog.setContentView(main);
                            WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
                  
                            LinearLayout linear = (LinearLayout)main.findViewById(R.id.ad_layout);
                  
                                ad = new AdView(this, AdSize.IAB_MRECT, "a15xxxxxxxx");
                  
                  
                          AdRequest request = new AdRequest();
                          Set<String> keywords = new HashSet<String>();
                          keywords.add("game");
                          request.setKeywords(keywords);
                  
                            linear.addView(ad);
                            ad.loadAd(request);
                  
                            dialog.setTitle("Title :");
                            dialog.setCancelable(true);
                  
                             //set up text
                            TextView text = (TextView) dialog.findViewById(R.id.hint_text);
                            text.setText(hint);
                  
                  
                           //set up button
                             Button button = (Button) dialog.findViewById(R.id.Button01);
                             button.setOnClickListener(new OnClickListener() {
                             public void onClick(View v) {
                                     dialog.dismiss();
                                }
                            });
                  
                            // now that the dialog is set up, it's time to show it    
                             lp.width = width;
                             lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
                             dialog.show();
                             dialog.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.ic_launcher);
                             dialog.getWindow().setAttributes(lp);
                             dialog.getWindow().getAttributes().width = LayoutParams.FILL_PARENT;
                             dialog.getWindow().getAttributes().height = LayoutParams.WRAP_CONTENT;
                       }
                     }    
                  }
                  

                  這篇關于自定義對話框上的 Admob 廣告的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)

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

                        <tbody id='aO0Kd'></tbody>
                        • <bdo id='aO0Kd'></bdo><ul id='aO0Kd'></ul>
                          1. <small id='aO0Kd'></small><noframes id='aO0Kd'>

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

                            主站蜘蛛池模板: 国产精品久久久久一区二区 | 特级黄一级播放 | 亚洲精品99 | 日韩伦理一区二区三区 | 天天爽夜夜操 | 欧美不卡在线 | 国际精品鲁一鲁一区二区小说 | 婷婷五月色综合 | 国产亚洲一区二区在线观看 | 成人一区二区视频 | 国产免费播放视频 | 久久精彩视频 | 欧洲视频一区二区 | 亚洲+变态+欧美+另类+精品 | 免费观看黄网站 | 国产激情视频在线免费观看 | 久久综合亚洲 | 午夜资源 | 久在线 | 精品久久久久久久久久久 | 日韩第一区 | 美女131mm久久爽爽免费 | 国产精品成人一区二区三区夜夜夜 | 少妇一级淫片aaaaaaaaa | 欧美激情黄色 | 中文字幕一区在线观看视频 | 日韩欧美在线视频 | 国产精品久久 | 草久久| 中文字幕视频在线观看 | 国产在线高清 | 国产日韩欧美 | 国产剧情一区 | 国产精品美女久久久久aⅴ国产馆 | 亚洲一区 中文字幕 | 日韩欧美三区 | 天天操操操操操 | 日批av| 黄色精品 | 精品中文在线 | 中文字幕在线三区 |