久久久久久久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 的主題設置為

        Android:How to programmatically set an Activity#39;s theme to Theme.Dialog(Android:如何以編程方式將 Activity 的主題設置為 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 的主題設置為 Theme.Dialog的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  所以我有一個 Activity(比如 TestActivity),它需要充當普通的非主題 Activity 以及 Theme.Dialog 在其他地方.我正在嘗試為這兩個任務重用相同的 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.

                  我正在尋找動態設置主題.代碼很簡單:這是我的活動的 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"/>
                  

                  同時我發現一個帖子說它不能在這里完成是帖子 http://code.google.com/p/android/issues/detail?id=4394 .但是有一種強烈的感覺是可以做到的.

                  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.

                  歡迎所有建議.

                  推薦答案

                  想解決這個問題.

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

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

                  解決方案:

                  1. 在您的 AndroidManifest.xml 中定義您的活動,主題為 @android:style/Theme.Dialog
                  2. 在您各自的 .Java 文件中,檢查定義 dialog 模式的 intent 額外內容.
                  3. 如果不存在,請將 Theme 設置為 android.R.style.Theme.這是默認的 theme,如果您未定義任何主題,則會應用它.
                  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);
                  }
                  

                  替代解決方案:

                  一個更復雜的解決方案是使用 AlertDialog 如下:

                  A more complex solution is to use AlertDialog as below:

                  1. 定義一個從 ArrayAdapter 擴展而來的 ListAdapter 類.
                  2. getCount函數中返回1

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

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

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

                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 中進行過多處理,這絕對是第二選擇.

                  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.

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

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

                  這篇關于Android:如何以編程方式將 Activity 的主題設置為 Theme.Dialog的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
                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精品久久久久 | 国产精品久久精品 | 久久综合一区 | 亚洲一区二区三区免费观看 | 欧美综合在线视频 | 亚洲精品1区 | 婷婷桃色网 | 精品中文在线 | 亚洲一区黄色 | 国产精品久久精品 | 成人国产精品久久 | 日韩免费视频 | 欧美一级一区 | 中文字幕一区二区三区日韩精品 | 91久久久久久久久久久 | 日韩精品区 | 嫩草伊人 | 国产91丝袜在线18 | 天天艹逼网 | 国产精品不卡 | 亚洲精品一区二区三区蜜桃久 | 99在线视频观看 | av一区二区三区四区 | 国产精品毛片一区二区在线看 | 精品成人av | 亚洲欧美在线观看视频 | 一区二区三区四区av | 五月婷婷亚洲 | 国产日韩欧美精品一区二区 | 在线不卡一区 | 成人在线精品视频 | 欧美大片久久久 | 国产成人福利在线 | 日韩精品免费在线观看 | 九色国产 | 欧美成人在线网站 | 成人久久久| 亚洲高清视频在线观看 | 欧美成人a∨高清免费观看 老司机午夜性大片 |