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

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

  • <tfoot id='CkXDH'></tfoot>

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

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

      1. Android:如何以編程方式將 Activity 的主題設(shè)置為

        Android:How to programmatically set an Activity#39;s theme to Theme.Dialog(Android:如何以編程方式將 Activity 的主題設(shè)置為 Theme.Dialog)
          <bdo id='tJ63f'></bdo><ul id='tJ63f'></ul>
          • <small id='tJ63f'></small><noframes id='tJ63f'>

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

                1. 本文介紹了Android:如何以編程方式將 Activity 的主題設(shè)置為 Theme.Dialog的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  所以我有一個(gè) Activity(比如 TestActivity),它需要充當(dāng)普通的非主題 Activity 以及 Theme.Dialog 在其他地方.我正在嘗試為這兩個(gè)任務(wù)重用相同的 TestActivity.

                  So I have an Activity (say TestActivity) which needs to act as a normal unthemed Activity as well as a Theme.Dialog at other place. I am trying to reuse same TestActivity for both the tasks.

                  我正在尋找動(dòng)態(tài)設(shè)置主題.代碼很簡單:這是我的活動(dòng)的 onCreate,適用于黑色背景

                  All I am looking for setting the theme dynamically. The code is simple: Here is my activity's onCreate that works with a black background

                  public void onCreate(Bundle icicle) {
                      if (Utility.isDialog == true)
                          setTheme(android.R.style.Theme_Dialog);
                      super.onCreate(icicle);
                      requestWindowFeature(Window.FEATURE_NO_TITLE);
                  .....
                  

                  這是清單條目

                  <activity android:name=".TestActivity"/>
                  

                  同時(shí)我發(fā)現(xiàn)一個(gè)帖子說它不能在這里完成是帖子 http://code.google.com/p/android/issues/detail?id=4394 .但是有一種強(qiáng)烈的感覺是可以做到的.

                  And in the meantime I found a post that says it can't be done here is the post http://code.google.com/p/android/issues/detail?id=4394 .But there is a strong feeling that it can be done.

                  歡迎所有建議.

                  推薦答案

                  想解決這個(gè)問題.

                  問題:如何使用相同的活動(dòng)作為對話框和全屏.

                  Problem : How to use the same activity as both dialog and full screen based.

                  解決方案:

                  1. 在您的 AndroidManifest.xml 中定義您的活動(dòng),主題為 @android:style/Theme.Dialog
                  2. 在您各自的 .Java 文件中,檢查定義 dialog 模式的 intent 額外內(nèi)容.
                  3. 如果不存在,請將 Theme 設(shè)置為 android.R.style.Theme.這是默認(rèn)的 theme,如果您未定義任何主題,則會(huì)應(yīng)用它.
                  1. Define your activity in your AndroidManifest.xml with the theme @android:style/Theme.Dialog
                  2. In your respective .Java file, check for an intent extra that defines dialog mode.
                  3. If it does not exist, set the Theme to android.R.style.Theme. This is the default theme which is applied if you do not define any theme.

                  代碼:

                  boolean fDialogMode = getIntent().hasExtra("dialog_mode");
                  
                  if( ! fDialogMode ) {
                      super.setTheme(android.R.style.Theme);
                  }
                  

                  替代解決方案:

                  一個(gè)更復(fù)雜的解決方案是使用 AlertDialog 如下:

                  A more complex solution is to use AlertDialog as below:

                  1. 定義一個(gè)從 ArrayAdapter 擴(kuò)展而來的 ListAdapter 類.
                  2. getCount函數(shù)中返回1

                  1. Define a ListAdapter class extended from ArrayAdapter.
                  2. return 1 in getCount function

                  @Override
                  public int getCount() { return 1; }
                  

                2. getView函數(shù)中,inflate你需要的activitylayout并做任何在返回 view 之前進(jìn)行自定義.

                3. In the getView function, inflate the layout of the activity you need and do any customization before returning the view.

                  @Override
                  public View getView( int position, View view, ViewGroup group ) {
                      View v = view;
                      if( v == null ) {
                          v = getSystemService(Context.LAYOUT_INFLATER_SERVICE).inflate( <layout res id>, null );
                      }
                  
                  ... Do any customization here    ....
                  
                        return v;
                  }
                  

                4. 如果您沒有在 activity class 中進(jìn)行過多處理,這絕對是第二選擇.

                  This is definitely a second choice option by if you are not doing too much processing in the activity class this could be an option.

                  考慮此解決方案的唯一原因可能是在 dialog 中顯示它的邏輯與用作對話框的地方隔離.

                  Only reason to consider this solution could be that the logic to show it in a dialog is isolated to the places where it is used as a dialog.

                  這兩個(gè)選項(xiàng)都對我有用,但出于顯而易見的原因,我選擇了第一個(gè)選項(xiàng).:-)

                  Both the options worked for me but for obvious reasons I am taking the first option. :-)

                  這篇關(guān)于Android:如何以編程方式將 Activity 的主題設(shè)置為 Theme.Dialog的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當(dāng)前位置)
                  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 或網(wǎng)絡(luò)提供商)
                  Get current location during app launch(在應(yīng)用啟動(dòng)期間獲取當(dāng)前位置)
                  locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)
                5. <i id='xaVht'><tr id='xaVht'><dt id='xaVht'><q id='xaVht'><span id='xaVht'><b id='xaVht'><form id='xaVht'><ins id='xaVht'></ins><ul id='xaVht'></ul><sub id='xaVht'></sub></form><legend id='xaVht'></legend><bdo id='xaVht'><pre id='xaVht'><center id='xaVht'></center></pre></bdo></b><th id='xaVht'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='xaVht'><tfoot id='xaVht'></tfoot><dl id='xaVht'><fieldset id='xaVht'></fieldset></dl></div>

                    • <tfoot id='xaVht'></tfoot>
                      <legend id='xaVht'><style id='xaVht'><dir id='xaVht'><q id='xaVht'></q></dir></style></legend>
                        <tbody id='xaVht'></tbody>

                      1. <small id='xaVht'></small><noframes id='xaVht'>

                          <bdo id='xaVht'></bdo><ul id='xaVht'></ul>
                            主站蜘蛛池模板: 亚洲欧美日韩精品 | 亚洲码欧美码一区二区三区 | 国产视频一区在线观看 | 日本免费一区二区三区 | 99久久婷婷国产综合精品电影 | 91在线色视频| 一级女毛片 | 羞羞视频在线观看免费观看 | 国产午夜精品一区二区三区嫩草 | 精品亚洲一区二区三区四区五区高 | 久久久久国产精品午夜一区 | 亚洲免费一区二区 | 欧美日韩一区在线 | 国产在线一区二区三区 | 国产精品国产三级国产aⅴ浪潮 | 亚洲第一区久久 | 亚洲一区久久久 | 中文在线一区 | 成人国产精品久久 | 91视视频在线观看入口直接观看 | 日韩三级在线 | 九色视频网站 | 妞干网福利视频 | 午夜影视免费片在线观看 | 久久高清精品 | 久久精品视频12 | 日韩在线观看中文字幕 | 国产精品久久久久av | 免费看欧美一级片 | 欧美一区二区三区在线观看 | 色综合色综合网色综合 | 天天爽天天操 | 国产一区二区观看 | 欧日韩在线观看 | 国产精品夜间视频香蕉 | 一区二区三区日韩 | 欧美一区二区三区在线 | 国产精品福利一区二区三区 | 久久精品黄色 | 国产玖玖 | 日韩超碰在线 |