我正在开发需要我实施标签的应用。我偶然发现了材料设计滑动标签。它在棒棒糖上工作得很好,但在android 4.1上工具栏和标签消失了,如下所示
但是在棒棒糖上它看起来像这样
下面的是我的xml视图
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/DrawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="7dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="#EEEEFF"
android:orientation="vertical">
<include
android:id="@+id/tool_bar"
layout="@layout/tool_bar">
</include>
<com.example.nappy.goodies.SlidingTabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="3dp"
android:background="@color/ColorPrimary"
android:layout_below="@+id/tool_bar"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<android.support.v4.view.ViewPager
android:id="@+id/viewpagerhome"
android:orientation="vertical"
android:background="#EEEEFF"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="41dp"
android:src="@drawable/home"
android:color="#EEEEFF"
android:elevation="5dp"
app:fabSize="normal"
app:layout_anchor="@+id/coordinatorLayout"
app:layout_anchorGravity="bottom|right|end"
app:rippleColor="#ff00786a"
android:layout_marginRight="42dp"
android:layout_marginEnd="42dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<include
android:id="@+id/RecyclerView"
layout="@layout/recycler">
</include>
请问我能在这里找到什么,我的所有dependecies都包含在我的app build.gradle中,如下所示
compile 'com.android.support:design:22.2.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'de.hdodenhof:circleimageview:1.2.1'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1@aar'
答案 0 :(得分:0)
我已经转移到Android设计库的TabLayout。 SlidingTabLayout有效,但确实有问题。
http://android-developers.blogspot.in/2015/05/android-design-support-library.html
还可以通过将此属性添加到viewpager
来将viewpager设置为低于标签android:layout_below="@+id/tabs"