Android 有可能有两级动作条吗?
我正在开发一个Android应用程序,实现了tabhost、viewpager、顶部滑动抽屉和底部标签。该应用程序使用android-support-v4 FragmentPagerAdapter,可以在v4支持包的示例中找到。可在此处找到参考资料:Android 有可能有两级动作条吗?,android,android-tabhost,fragment,slidingdrawer,Android,Android Tabhost,Fragment,Slidingdrawer,我正在开发一个Android应用程序,实现了tabhost、viewpager、顶部滑动抽屉和底部标签。该应用程序使用android-support-v4 FragmentPagerAdapter,可以在v4支持包的示例中找到。可在此处找到参考资料: 我似乎无法让滑动抽屉和TabHost同时出现在屏幕上 这是我的布局。com.mobicartel。。。block是一个定制的滑动抽屉---------------------------------------------------------
我似乎无法让滑动抽屉和TabHost同时出现在屏幕上 这是我的布局。com.mobicartel。。。block是一个定制的滑动抽屉-------------------------------------------------------------------------------------------
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:my="http://schemas.android.com/apk/res/com.mobicartel.tabsandpager"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.mobicartel.tabsandpager.slidingdrawer.MultiDirectionSlidingDrawer
xmlns:my="http://schemas.android.com/apk/res/com.mobicartel.tabsandpager"
android:id="@+id/drawer"
my:direction="topToBottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
my:handle="@+id/handle"
my:content="@+id/content">
<include
android:id="@id/content"
layout="@layout/pen_content" />
<ImageButton
android:id="@id/handle"
android:layout_width="wrap_content"
android:layout_height="40px"
android:src="@drawable/sliding_drawer_handle_bottom" />
</com.mobicartel.tabsandpager.slidingdrawer.MultiDirectionSlidingDrawer>
<FrameLayout
android:id="@+id/tab_host_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/drawer">
<TabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"/>
<TabWidget
android:id="@android:id/tabs"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:layout_marginBottom="-4dip"/>
</LinearLayout>
</TabHost>
</FrameLayout>
TabHost的内容实际上没有显示。相反,选项卡listener和viewpager listener相互控制,使它们同步。ViewPager由一个特殊的适配器填充片段
有什么想法吗
是否有人我从未使用底部带有选项卡的TabHost,因为(在官方设计指南中)建议不要使用它,但是,您似乎正在使用此处找到的hack: 我注意到您的
FrameLayout
重量以及高度和宽度为0。尝试将它们设置为:
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_weight="1"/>
正如链接到的答案所示。我从未使用底部带有选项卡的TabHost,因为(在官方设计指南中)建议不要使用它,但是,您似乎正在使用此处找到的hack: 我注意到您的
FrameLayout
重量以及高度和宽度为0。尝试将它们设置为:
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_weight="1"/>
如链接到的答案所示。谢谢Paul,框架布局设置为0 dims,因为它实际上不应该显示。内容将显示在视图寻呼机中。我遵循的是iPhone的设计,所以标签必须放在底部,但我会在未来的项目中注意设计指南。谢谢Paul,框架布局设置为0 dims,因为它实际上不应该显示。内容将显示在视图寻呼机中。我遵循的是iPhone的设计,所以标签必须放在底部,但我会在未来的项目中注意设计指南。