【问题标题】:Spinner cannot selected in Frame layout无法在框架布局中选择微调器
【发布时间】:2017-06-30 15:08:48
【问题描述】:

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

<?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 之外也可以。非常感谢您的所有帮助:)

【问题讨论】:

  • TabHost 已弃用。请改用 TabLayout。

标签: android layout spinner


【解决方案1】:

请在框架布局中替换此行,

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

有了这个,

 android:id="@+id/tabcontent"

【讨论】:

  • 感谢您的帮助。但是发生了异常。 “原因:java.lang.RuntimeException:您的 TabHost 必须有一个 id 属性为 'android.R.id.tabcontent' 的 FrameLayout”
  • 我解决了这个问题。因为我包含的布局有滚动视图,所以 Spinner 发生冲突。移除 Scroll View Spinner 时可以选择。感谢您的帮助。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-10-15
  • 1970-01-01
  • 2020-10-03
  • 2012-01-25
  • 1970-01-01
  • 1970-01-01
  • 2020-09-18
相关资源
最近更新 更多