微调框无法在框架布局中选择

问题描述:

无法在框架布局中选择微调框下拉列表。这是代码。预先感谢您的帮助。微调框无法在框架布局中选择

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/activity_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <TabHost 
     android:id="@+id/tab_host" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical"> 

      <TabWidget 
       android:id="@android:id/tabs" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 

      <FrameLayout 
       android:id="@android:id/tabcontent" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 

       <Spinner 
        android:id="@+id/ddlSsid" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginStart="50dp" /> 

       <include layout="@layout/information" /> 

       <include layout="@layout/network" /> 

       <include layout="@layout/ping_ip_setting" /> 

       <include layout="@layout/scan_information" /> 
      </FrameLayout> 
     </LinearLayout> 
    </TabHost> 
</LinearLayout> 

如果微调框设置在FrameLayout之外,那么确定。非常感谢你对所有帮助:)

+1

TabHost已被弃用。改用TabLayout。 –

请更换框架布局这一行,

android:id="@android:id/tabcontent" 

与此,

android:id="@+id/tabcontent" 
+1

这将如何解决问题? –

+0

感谢您的帮助。但发生异常。 “由...引发:java.lang.RuntimeException:你的TabHost必须有一个FrameLayout,它的id属性是'android.R.id.tabcontent'' – pes

+0

@pes检查这个 - [stackoverflow.com/questions/8538437](https:// stackoverflow.com/questions/8538437/your-content-must-have-a-tabhost-whose-id-attribute-is-android-r-id-tabhost) –