pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

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

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

      1. 在自定義對話框中設置微調器

        Set spinner within custom dialog(在自定義對話框中設置微調器)

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

              <bdo id='GTdwc'></bdo><ul id='GTdwc'></ul>

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

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

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

                  問題描述

                  我在嘗試在對話框中創建 Spinner 時遇到 NullPointerException,并且似乎無法調試它,因為代碼看起來很可靠.想知道其他人是否有任何想法.非常感謝任何幫助.

                  I'm getting a NullPointerException while attempting to create a Spinner within a dialog and can't seem to debug it because the code looks solid. Wonder if anyone else has any idea. Any help is greatly appreciated.

                      protected Dialog onCreateDialog(int id)
                      {
                          Dialog dialog;
                          switch(id) {
                          case DIALOG_SEND_PM:
                              Spinner spinner = (Spinner)findViewById(R.id.pm_server);
                              ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.server_array, android.R.layout.simple_spinner_item);
                              adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                              spinner.setAdapter(adapter);
                              spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());
                  
                              dialog = new Dialog(PM.this);
                              dialog.setContentView(R.layout.send_pm_dialog);
                              dialog.setTitle(R.string.send_pm);
                              pmMessage = (EditText) dialog.findViewById(R.id.send_pm_box);
                              Button sendPm = (Button) dialog.findViewById(R.id.send_pm_button);
                              sendPm.setOnClickListener(PM.this);
                              break;
                          default:
                              dialog = null;
                     }
                  

                  我在 adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);我將上下文更改為 MyClass.this 并將異常移至下一行,這讓我感到困惑.我想知道它是否是具有空值的適配器,但我在不在對話框中時以與以前相同的方式調用所有內容.

                  I get the exception at adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); I changed the context to MyClass.this and the exception moved down to the next line, which confuses me. I'm wondering if it is the adapter having a null value but I call everything the same way I have before while not in a dialog.

                  相關的 XML 數據:

                  Relevant XML data:

                  <LinearLayout>
                      <TextView/>
                  
                      <LinearLayout>
                  
                         <TextView/>
                        <EditText/>
                        <TextView/>
                        <Spinner
                          android:id="@+id/pm_server"
                          android:layout_height="fill_parent"
                          android:layout_width="wrap_content"
                          android:background="@drawable/yblueborder"
                          android:textColor="#ABABAB"/>
                      </LinearLayout>
                  
                      <Button/>
                  </LinearLayout>
                  

                  編輯了其余的數據,以免占用太多空間.

                  Edited out the rest of the data so it wouldn't take up too much space.

                  推薦答案

                  我已經設法解決了這個問題.這是非常微妙的,我很確定我很幸運.這是工作代碼:

                  I have managed to fix the issue. It was very subtle and I'm pretty sure I got lucky. Here's the working code:

                  protected Dialog onCreateDialog(int id)
                      {
                          Dialog dialog;
                          switch(id) {
                          case DIALOG_SEND_PM:
                              dialog = new Dialog(PM.this);
                              dialog.setContentView(R.layout.send_pm_dialog);
                              dialog.setTitle(R.string.send_pm);
                              pmMessage = (EditText) dialog.findViewById(R.id.send_pm_box);
                              Button sendPm = (Button) dialog.findViewById(R.id.send_pm_button);
                              sendPm.setOnClickListener(PM.this);
                  
                              Spinner spinner = (Spinner)dialog.findViewById(R.id.pm_server);
                              ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.server_array, android.R.layout.simple_spinner_item);
                              adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                              spinner.setAdapter(adapter);
                              spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());
                              break;
                          default:
                              dialog = null;
                          }
                          return dialog;
                      }
                  

                  我移動了一些代碼,以便在微調器之前初始化對話框,但這不是問題.我添加了對話框.在 Spinner spinner = (Spinner)dialog.findViewById(R.id.pm_server);這就是訣竅.希望這對其他人有幫助.

                  I moved some of the code around so that the dialog was initialized before the spinner, but that was not the issue. I added dialog. in Spinner spinner = (Spinner)dialog.findViewById(R.id.pm_server); and that did the trick. Hope this helps others.

                  這篇關于在自定義對話框中設置微調器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)
                • <small id='gkDwG'></small><noframes id='gkDwG'>

                    <tbody id='gkDwG'></tbody>

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

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

                          • <tfoot id='gkDwG'></tfoot>
                            主站蜘蛛池模板: 高铝矾土熟料_细粉_骨料_消失模_铸造用铝矾土_铝酸钙粉—嵩峰厂家 | 小型UV打印机-UV平板打印机-大型uv打印机-UV打印机源头厂家 |松普集团 | 打孔器,打孔钳厂家【温州新星德牌五金工具】 | 扒渣机厂家_扒渣机价格_矿用扒渣机_铣挖机_撬毛台车_襄阳永力通扒渣机公司 | 代理记账_公司起名核名_公司注册_工商注册-睿婕实业有限公司 | 北京易通慧公司从事北京网站优化,北京网络推广、网站建设一站式服务商-北京网站优化公司 | 广东燎了网络科技有限公司官网-网站建设-珠海网络推广-高端营销型外贸网站建设-珠海专业h5建站公司「了了网」 | 艺术漆十大品牌_艺术涂料加盟代理_蒙太奇艺术涂料厂家品牌|艺术漆|微水泥|硅藻泥|乳胶漆 | 全温恒温摇床-水浴气浴恒温摇床-光照恒温培养摇床-常州金坛精达仪器制造有限公司 | 济南玻璃安装_济南玻璃门_济南感应门_济南玻璃隔断_济南玻璃门维修_济南镜片安装_济南肯德基门_济南高隔间-济南凯轩鹏宇玻璃有限公司 | 贴片电容代理-三星电容-村田电容-风华电容-国巨电容-深圳市昂洋科技有限公司 | 蔡司三坐标-影像测量机-3D扫描仪-蔡司显微镜-扫描电镜-工业CT-ZEISS授权代理商三本工业测量 | 液压升降平台_剪叉式液压/导轨式升降机_传菜机定做「宁波日腾升降机厂家」 | 赛默飞Thermo veritiproPCR仪|ProFlex3 x 32PCR系统|Countess3细胞计数仪|371|3111二氧化碳培养箱|Mirco17R|Mirco21R离心机|仟诺生物 | 东莞压铸厂_精密压铸_锌合金压铸_铝合金压铸_压铸件加工_东莞祥宇金属制品 | 熔体泵_熔体出料泵_高温熔体泵-郑州海科熔体泵有限公司 | 中高频感应加热设备|高频淬火设备|超音频感应加热电源|不锈钢管光亮退火机|真空管烤消设备 - 郑州蓝硕工业炉设备有限公司 | 挤奶设备过滤纸,牛奶过滤纸,挤奶机过滤袋-济南蓝贝尔工贸有限公司 | 二手Sciex液质联用仪-岛津气质联用仪-二手安捷伦气质联用仪-上海隐智科学仪器有限公司 | 发电机组|柴油发电机组-批发,上柴,玉柴,潍柴,康明斯柴油发电机厂家直销 | H型钢切割机,相贯线切割机,数控钻床,数控平面钻,钢结构设备,槽钢切割机,角钢切割机,翻转机,拼焊矫一体机 | 沈阳庭院景观设计_私家花园_别墅庭院设计_阳台楼顶花园设计施工公司-【沈阳现代时园艺景观工程有限公司】 | 邢台人才网_邢台招聘网_邢台123招聘【智达人才网】 | 热缩管切管机-超声波切带机-织带切带机-无纺布切布机-深圳市宸兴业科技有限公司 | 分轨 | 上传文件,即刻分离人声和伴奏 | 章丘丰源机械有限公司 - 三叶罗茨风机,罗茨鼓风机,罗茨风机 | 岛津二手液相色谱仪,岛津10A液相,安捷伦二手液相,安捷伦1100液相-杭州森尼欧科学仪器有限公司 | 贴片电感_贴片功率电感_贴片绕线电感_深圳市百斯特电子有限公司 贴片电容代理-三星电容-村田电容-风华电容-国巨电容-深圳市昂洋科技有限公司 | 山东螺杆空压机,烟台空压机,烟台开山空压机-烟台开山机电设备有限公司 | 亚洲工业智能制造领域专业门户网站 - 亚洲自动化与机器人网 | POM塑料_PBT材料「进口」聚甲醛POM杜邦原料、加纤PBT塑料报价格找利隆塑料 | 宁夏活性炭_防护活性炭_催化剂载体炭-宁夏恒辉活性炭有限公司 | 商用绞肉机-熟肉切片机-冻肉切丁机-猪肉开条机 - 广州市正盈机械设备有限公司 | 汝成内控-行政事业单位内部控制管理服务商 | 耐磨陶瓷,耐磨陶瓷管道_厂家-淄博拓创陶瓷科技 | 无刷电机_直流无刷电机_行星减速机-佛山市藤尺机电设备有限公司 无菌检查集菌仪,微生物限度仪器-苏州长留仪器百科 | 直读光谱仪,光谱分析仪,手持式光谱仪,碳硫分析仪,创想仪器官网 | 篮球架_乒乓球台_足球门_校园_竞技体育器材_厂家_价格-沧州浩然体育器材有限公司 | 客服外包专业服务商_客服外包中心_网萌科技| 动物解剖台-成蚊接触筒-标本工具箱-负压实验台-北京哲成科技有限公司 | 合肥防火门窗/隔断_合肥防火卷帘门厂家_安徽耐火窗_良万消防设备有限公司 |