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

      <legend id='6rP6j'><style id='6rP6j'><dir id='6rP6j'><q id='6rP6j'></q></dir></style></legend><tfoot id='6rP6j'></tfoot>

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

        <bdo id='6rP6j'></bdo><ul id='6rP6j'></ul>

      1. 對話框內(nèi)選項卡布局內(nèi)的Android listview無法顯示滾

        Android listview inside tab layout inside dialog can#39;t get scroll bars to show up(對話框內(nèi)選項卡布局內(nèi)的Android listview無法顯示滾動條)

          <legend id='hhYq6'><style id='hhYq6'><dir id='hhYq6'><q id='hhYq6'></q></dir></style></legend>

              <tbody id='hhYq6'></tbody>

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

                • <bdo id='hhYq6'></bdo><ul id='hhYq6'></ul>
                  <tfoot id='hhYq6'></tfoot>
                  <i id='hhYq6'><tr id='hhYq6'><dt id='hhYq6'><q id='hhYq6'><span id='hhYq6'><b id='hhYq6'><form id='hhYq6'><ins id='hhYq6'></ins><ul id='hhYq6'></ul><sub id='hhYq6'></sub></form><legend id='hhYq6'></legend><bdo id='hhYq6'><pre id='hhYq6'><center id='hhYq6'></center></pre></bdo></b><th id='hhYq6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='hhYq6'><tfoot id='hhYq6'></tfoot><dl id='hhYq6'><fieldset id='hhYq6'></fieldset></dl></div>
                  本文介紹了對話框內(nèi)選項卡布局內(nèi)的Android listview無法顯示滾動條的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我有一個擴(kuò)展 Dialog 的自定義對話框類.在這里面我有一個帶有 2 個選項卡的選項卡布局.在每個選項卡中,我都有一個列表視圖.一切正常,但我無法顯示滾動條.

                  I have a custom dialog class that extends Dialog. Inside this I have a Tab Layout with 2 tabs. In each tab I have a list view. Everything works but I can't get scroll bars to show up.

                  這是我的 XML:

                  <?xml version="1.0" encoding="utf-8"?>
                  
                  <TabHost
                  xmlns:android="http://schemas.android.com/apk/res/android"
                  android:id="@+id/TabHost01"
                  android:layout_width="300dp"
                  android:layout_height="300dp">
                  
                      <LinearLayout
                      android:orientation="vertical"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content">
                  
                      <TabWidget
                          android:id="@android:id/tabs"
                          android:layout_width="fill_parent"
                          android:layout_height="wrap_content"/>
                  
                      <FrameLayout
                          android:id="@android:id/tabcontent"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content">
                  
                      <ListView
                          android:id="@+id/ListView01"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:scrollbars="vertical"
                          android:scrollbarAlwaysDrawVerticalTrack="true"/>
                  
                      <ListView
                          android:id="@+id/ListView02"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:scrollbars="vertical"
                          android:scrollbarAlwaysDrawVerticalTrack="true"/>
                  
                      </FrameLayout>
                  </LinearLayout>
                  </TabHost>
                  

                  這是我設(shè)置它的代碼的一部分:

                  and here is part of my code that sets this up:

                      // get this window's layout parameters so we can change the position
                  WindowManager.LayoutParams params = getWindow().getAttributes(); 
                  
                      // change the position. 0,0 is center
                      params.x = 0;
                      params.y = 250;
                      this.getWindow().setAttributes(params); 
                  
                      // no title on this dialog
                  requestWindowFeature(Window.FEATURE_NO_TITLE);
                  
                  setContentView(R.layout.myLayout);
                  
                  // instantiate our list views for each tab
                  ListView listView01 = (ListView)findViewById(R.id.ListView01);
                  ListView listView02 = (ListView)findViewById(R.id.ListView02);
                  
                  
                  // instantiate and set our custom list view adapters
                  listViewAdapter01 = new ListViewAdapter01(context);
                  listView01.setAdapter(listViewAdapter01);
                  
                  listViewAdapter02 = new ListViewAdapter02(context);
                  listView02.setAdapter(listViewAdapter02);
                  
                  // get our tabHost from the xml
                  TabHost tabs = (TabHost)findViewById(R.id.TabHost01);
                  tabs.setup();
                  
                  // create tab 1
                  TabHost.TabSpec tab1 = tabs.newTabSpec("tab1");
                  tab1.setContent(R.id.listView01);
                  tab1.setIndicator("List 1");
                  tabs.addTab(tab1);
                  
                  // create tab 2
                  TabHost.TabSpec tab2 = tabs.newTabSpec("tab2");
                  tab2.setContent(R.id.listView02);
                  tab2.setIndicator("List 01");
                  tabs.addTab(tab2);
                  

                  推薦答案

                  好的,這里是自定義對話框類的完整工作代碼,其中包含一個包含 listView 的選項卡式布局.第一個選項卡有一個 listView ,其中行是 textView 和 imageView ,其中 imageView 是右對齊的.第二個選項卡有一個 listView,其中行是一個 textView.滾動條設(shè)置為較長的??淡入淡出持續(xù)時間,以使其始終顯示.對話框窗口本身設(shè)置為靜態(tài)大小,以防止對話框在切換選項卡時調(diào)整大小.對話窗口也位于屏幕下方,而不是中心.listViews 使用自定義適配器,并且第二個選項卡的 listView 注冊為上下文菜單.

                  OK here is the complete working code for a custom dialog class that contains a tabbed layout which contains a listView. The first tab has a listView with rows being a textView and an imageView with the imageView being right aligned. The second tab has a listView with rows being a single textView. The scroll bars are set to a high fade duration to make them always show. The dialog window itself is set to a static size to prevent the dialog from resizing when switching tabs. The dialog window is also positioned lower on the screen, not in the center. The listViews use custom adapters and the second tab's listView is registered for a context menu.

                  我已將所有內(nèi)容重命名為更通用,并且不包含我們產(chǎn)品的名稱,因此我在重命名時可能會出現(xiàn)一些拼寫錯誤,但我認(rèn)為一切都是正確的.盡我所能對代碼進(jìn)行注釋.希望這對某些人有所幫助.

                  I have renamed everything to be more generic and ont contain names of our product, so I may have made some typos when renaming but I think everything is right. Tried to comment the code as best I could. Hope this helps some people.

                  customDialog 的 XML (custom_dialog_layout.xml):

                  The customDialog's XML (custom_dialog_layout.xml):

                  <?xml version="1.0" encoding="utf-8"?>
                  
                  <TabHost
                      xmlns:android="http://schemas.android.com/apk/res/android"
                      android:id="@+id/TabHost01"
                      android:layout_width="fill_parent"
                      android:layout_height="300dip">
                  
                      <LinearLayout
                          android:orientation="vertical"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content">
                  
                          <TabWidget
                              android:id="@android:id/tabs"
                              android:layout_width="fill_parent"
                              android:layout_height="wrap_content"/>
                  
                          <FrameLayout
                              android:id="@android:id/tabcontent"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content">
                  
                          <ListView
                              android:id="@+id/listView01"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:scrollbars="vertical"
                              android:scrollbarFadeDuration="1000000"/>
                  
                          <ListView
                              android:id="@+id/listView02"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:scrollbars="vertical"
                              android:scrollbarFadeDuration="1000000"/>
                  
                          </FrameLayout>
                      </LinearLayout>
                  </TabHost>
                  

                  選項卡 1 listView 行 XML (list_view_01_row.xml).這是一個左對齊的 textView 和一個右對齊的 imageView.textView 已設(shè)置為更大的高度,以強(qiáng)制 listView 行更高.listView 也被設(shè)置為特定的寬度,這會將 imageView 推到右側(cè)以使其右對齊.

                  Tab 1 listView row XML (list_view_01_row.xml). This is a textView, left aligned and an imageView, right aligned. The textView has been set to a larger height in order to force the listView rows to be higher. The listView has also been set to a specific width, this pushes the imageView to the right in order to right align it.

                  <?xml version="1.0" encoding="utf-8"?>
                  
                  <LinearLayout
                      xmlns:android="http://schemas.android.com/apk/res/android"
                      android:orientation="vertical"
                      android:layout_width="fill_parent"
                      android:layout_height="fill_parent"
                      android:paddingBottom="5dip"
                      android:paddingTop="5dip"
                      android:paddingLeft="10dip"
                      android:paddingRight="10dip">
                  
                      <TableLayout
                          android:id="@+id/list_view_01_row_table_layout"
                          android:layout_width="fill_parent"
                          android:layout_height="wrap_content"
                          android:stretchColumns="0">
                  
                          <TableRow
                              android:id="@+id/list_view_01_row_table_row"
                              android:gravity="center_vertical"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content">
                  
                                  <TextView
                                      android:id="@+id/list_view_01_row_text_view"
                                      android:textSize="18sp"
                                      android:textColor="#ffffff"  
                                      android:gravity="center_vertical"
                                      android:layout_width="200dip" 
                                      android:layout_height="75dip" />
                  
                                  <ImageView
                                      android:id="@+id/list_view_01_row_image_view"
                                      android:layout_width="wrap_content"
                                      android:layout_height="wrap_content"/>
                          </TableRow>
                      </TableLayout>
                  </LinearLayout>
                  

                  選項卡 2 listView 行 XML (list_view_02_row.xml).與選項卡 1 相同,但只有一個 textView,沒有 imageView.

                  Tab 2 listView row XML (list_view_02_row.xml). Same as tab 1 but with a single textView, no imageView.

                  <?xml version="1.0" encoding="utf-8"?>
                  
                  <LinearLayout
                      xmlns:android="http://schemas.android.com/apk/res/android"
                      android:orientation="vertical"
                      android:layout_width="fill_parent"
                      android:layout_height="fill_parent"
                      android:paddingBottom="5dip"
                      android:paddingTop="5dip"
                      android:paddingLeft="10dip"
                      android:paddingRight="10dip">
                  
                      <TableLayout
                          android:id="@+id/list_view_02_row_table_layout"
                          android:layout_width="fill_parent"
                          android:layout_height="wrap_content"
                          android:stretchColumns="0">
                  
                          <TableRow
                              android:id="@+id/list_view_02_row_table_row"
                              android:gravity="center_vertical"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content">
                  
                              <TextView
                                  android:id="@+id/list_view_02_row_text_view"
                                  android:textSize="18sp"
                                  android:textColor="#ffffff"  
                                  android:gravity="center_vertical"
                                  android:layout_width="fill_parent" 
                                  android:layout_height="75dip" />
                          </TableRow>
                      </TableLayout>
                  </LinearLayout>
                  

                  最后是自定義 Dialog 類.

                  And finally the custom Dialog class.

                  import android.app.Dialog;
                  import android.content.Context;
                  import android.view.ContextMenu;
                  import android.view.LayoutInflater;
                  import android.view.MenuItem;
                  import android.view.View;
                  import android.view.ViewGroup;
                  import android.view.Window;
                  import android.view.WindowManager;
                  import android.view.ContextMenu.ContextMenuInfo;
                  import android.widget.AdapterView;
                  import android.widget.BaseAdapter;
                  import android.widget.ImageView;
                  import android.widget.ListView;
                  import android.widget.TabHost;
                  import android.widget.TextView;
                  
                  /**
                   * This is a custom dialog class that will hold a tab view with 2 tabs.
                   * Tab 1 will be a list view. Tab 2 will be a list view.
                   * 
                   */
                  public class CustomDialog extends Dialog
                  {
                      /**
                       * Our custom list view adapter for tab 1 listView (listView01).
                       */
                      ListView01Adapter listView01Adapter = null;
                  
                      /**
                       * Our custom list view adapter for tab2 listView (listView02).
                       */
                      ListView02Adapter listView02Adapter = null;
                  
                      /**
                       * Default constructor.
                       * 
                       * @param context
                       */
                      public CustomDialog(Context context)
                      {
                          super(context);
                  
                          // get this window's layout parameters so we can change the position
                          WindowManager.LayoutParams params = getWindow().getAttributes(); 
                  
                          // change the position. 0,0 is center
                          params.x = 0;
                          params.y = 250;
                          this.getWindow().setAttributes(params); 
                  
                          // no title on this dialog
                          requestWindowFeature(Window.FEATURE_NO_TITLE);
                  
                          setContentView(R.layout.custom_dialog_layout);
                  
                          // instantiate our list views for each tab
                          ListView listView01 = (ListView)findViewById(R.id.listView01);
                          ListView listView02 = (ListView)findViewById(R.id.listView02);
                  
                          // register a context menu for all our listView02 items
                          registerForContextMenu(listView02);
                  
                          // instantiate and set our custom list view adapters
                          listView01Adapter = new ListView01Adapter(context);
                          listView01.setAdapter(listView01Adapter);
                  
                          listView02Adapter = new ListView02Adapter(context);
                          listView02.setAdapter(listView02Adapter);
                  
                          // bind a click listener to the listView01 list
                          listView01.setOnItemClickListener(new AdapterView.OnItemClickListener()
                          {
                              public void onItemClick(AdapterView<?> parentView, View childView, int position, long id)
                              {                   
                                  // will dismiss the dialog
                                  dismiss();
                              }           
                          });
                  
                          // bind a click listener to the listView02 list
                          listView02.setOnItemClickListener(new AdapterView.OnItemClickListener()
                          {
                              public void onItemClick(AdapterView<?> parentView, View childView, int position, long id)
                              {                   
                                  // will dismiss the dialog
                                  dismiss();          
                              }           
                          });
                  
                          // get our tabHost from the xml
                          TabHost tabs = (TabHost)findViewById(R.id.TabHost01);
                          tabs.setup();
                  
                          // create tab 1
                          TabHost.TabSpec tab1 = tabs.newTabSpec("tab1");
                          tab1.setContent(R.id.listView01);
                          tab1.setIndicator("List 1");
                          tabs.addTab(tab1);
                  
                          // create tab 2
                          TabHost.TabSpec tab2 = tabs.newTabSpec("tab2");
                          tab2.setContent(R.id.listView02);
                          tab2.setIndicator("List 2");
                          tabs.addTab(tab2);
                      }
                  
                      /**
                       * A custom list adapter for the listView01
                       */
                      private class ListView01Adapter extends BaseAdapter
                      {        
                          public ListView01Adapter(Context context)
                          {
                  
                          }
                  
                          /**
                           * This is used to return how many rows are in the list view
                           */
                          public int getCount()
                          {
                              // add code here to determine how many results we have, hard coded for now
                  
                              return 10;
                          }
                  
                          /**
                           * Should return whatever object represents one row in the
                           * list.
                           */
                          public Object getItem(int position)
                          {
                              return position;
                          }
                  
                          /**
                           * Used to return the id of any custom data object.
                           */
                          public long getItemId(int position)
                          {
                              return position;
                          }
                  
                          /**
                           * This is used to define each row in the list view.
                           */
                          public View getView(int position, View convertView, ViewGroup parent)
                          {            
                              View row = convertView;
                  
                              // our custom holder will represent the view on each row. See class below.
                              ListView01Holder holder = null;
                  
                              if(row == null)
                              {                                                   
                                  LayoutInflater inflater = getLayoutInflater();
                  
                                  // inflate our row from xml
                                  row = inflater.inflate(R.layout.list_view_01_row, parent, false);
                  
                                  // instantiate our holder
                                  holder = new ListView01Holder(row);
                  
                                  // set our holder to the row
                                  row.setTag(holder);
                              }
                              else
                              {
                                  holder = (ListView01Holder)row.getTag();
                              }
                  
                              return row;
                          }
                  
                          // our custom holder
                          class ListView01Holder
                          {
                              // text view
                              private TextView text = null;
                  
                              // image view
                              private ImageView image = null;
                  
                              ListView01Holder(View row)
                              {    
                                  // get out text view from xml
                                  text = (TextView)row.findViewById(R.id.image);
                  
                                  // add code here to set the text
                                  text.setText("");
                  
                                  // get our image view from xml
                                  image = (ImageView)row.findViewById(R.id.list_view_01_row_image_view);
                  
                                  // add code here to determine which image to load, hard coded for now
                                  rating.setImageResource(R.drawable.image);
                              }
                          }
                      }
                  
                      /**
                       * A custom list adapter for listView02
                       */
                      private class ListView02Adapter extends BaseAdapter
                      {        
                          public ListView02Adapter(Context context)
                          {
                  
                          }
                  
                          /**
                           * This is used to return how many rows are in the list view
                           */
                          public int getCount()
                          {
                              // add code here to determine how many results we have, hard coded for now
                  
                              return 5;
                          }
                  
                          /**
                           * Should return whatever object represents one row in the
                           * list.
                           */
                          public Object getItem(int position)
                          {
                              return position;
                          }
                  
                          /**
                           * Used to return the id of any custom data object.
                           */
                          public long getItemId(int position)
                          {
                              return position;
                          }
                  
                          /**
                           * This is used to define each row in the list view.
                           */
                          public View getView(int position, View convertView, ViewGroup parent)
                          {            
                              View row = convertView;
                              ListView02Holder holder = null;
                  
                              if(row == null)
                              {                                                   
                                  LayoutInflater inflater = getLayoutInflater();
                  
                                  row=inflater.inflate(R.layout.list_view_02_row, parent, false);
                                  holder = new ListView02Holder(row);
                                  row.setTag(holder);
                              }
                              else
                              {
                                  holder = (ListView02Holder)row.getTag();
                              }
                  
                              return row;
                          }
                  
                          class ListView02Holder
                          {
                              private TextView text = null;
                  
                              ListView02Holder(View row)
                              {
                                  text = (TextView)row.findViewById(R.id.list_view_02_row_text_view);
                                  text.setText("");
                              }
                          }
                      }
                  
                      /**
                       * This is called when a long press occurs on our listView02 items.
                       */
                      public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
                      {
                          super.onCreateContextMenu(menu, v, menuInfo);
                  
                          menu.setHeaderTitle("Context Menu");  
                          menu.add(0, v.getId(), 0, "Delete");  
                      }
                  
                      /**
                       * This is called when an item in our context menu is clicked.
                       */
                      public boolean onContextItemSelected(MenuItem item)
                      {  
                          if(item.getTitle() == "Delete")
                          {
                  
                          }  
                          else
                          {
                              return false;
                          }
                  
                          return true;  
                      }  
                  }
                  

                  這篇關(guān)于對話框內(nèi)選項卡布局內(nèi)的Android listview無法顯示滾動條的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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)前位置)
                  locationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)

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

                        <tbody id='aPWe9'></tbody>
                        <bdo id='aPWe9'></bdo><ul id='aPWe9'></ul>

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

                          1. <tfoot id='aPWe9'></tfoot>
                          2. <i id='aPWe9'><tr id='aPWe9'><dt id='aPWe9'><q id='aPWe9'><span id='aPWe9'><b id='aPWe9'><form id='aPWe9'><ins id='aPWe9'></ins><ul id='aPWe9'></ul><sub id='aPWe9'></sub></form><legend id='aPWe9'></legend><bdo id='aPWe9'><pre id='aPWe9'><center id='aPWe9'></center></pre></bdo></b><th id='aPWe9'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='aPWe9'><tfoot id='aPWe9'></tfoot><dl id='aPWe9'><fieldset id='aPWe9'></fieldset></dl></div>
                            主站蜘蛛池模板: 国产视频第一页 | 久久久久久久久久久久亚洲 | 亚洲精品视频免费观看 | 亚洲精品一区二三区不卡 | 日韩视频一区二区 | 精精国产xxxx视频在线播放 | 日本一二三区在线观看 | 337p日本欧洲亚洲大胆精蜜臀 | 日韩视频免费在线 | 日韩视频国产 | 国产成人精品一区二区三区视频 | 国产精品久久久久久久久 | 国产精品91久久久久久 | 亚州中文字幕 | 国产精品久久9 | 91麻豆精品国产91久久久久久久久 | 日本午夜网 | 岛国在线免费观看 | 操网站 | 91精品国产欧美一区二区 | 国产精品美女 | av网站在线免费观看 | 在线色 | 国产精品亚洲一区 | 九九精品影院 | 久久69精品久久久久久久电影好 | 81精品国产乱码久久久久久 | 在线免费观看毛片 | 综合久久av | 成人午夜免费在线视频 | 精品久久久精品 | 成人影视网 | 久久久久久91 | 欧美一区二区三区久久精品视 | 欧美一区二区三区视频在线播放 | 国产高清精品在线 | 日韩一区欧美一区 | 在线免费av电影 | 中日字幕大片在线播放 | 国产一区二区在线免费观看 | 国产精品美女www爽爽爽 |