大佬教程收集整理的这篇文章主要介绍了android – 在使用TabLayout和ViewPager的Fragment中启用滚动,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
如您所见,TAB1中的“TEMP CONTENT”就是模拟可能出现的临时内容.
我现在要做的是使整个页面可滚动.我设法做的是制作TAB1的内容,因此,TabLayout的内容可滚动,但这不是我想要做的.如上所述,整个页面应该是.
这是持有视图的布局:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://scheR_932_11845@as.android.com/apk/res/android" xmlns:app="http://scheR_932_11845@as.android.com/apk/res-auto" xmlns:tools="http://scheR_932_11845@as.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" app:layouT_Behavior="@@R_616_10495@ng/appbar_scrolling_view_behavior" tools:context="at.codecrane.whosnext.MainActivity"> <RelativeLayout android:layout_width="match_parent" android:layout_height="200dp"> <ImageView android:id="@+id/imageView2" android:layout_width="match_parent" android:layout_height="match_parent" app:srcCompat="@android:color/darker_gray" /> <ImageView android:id="@+id/imageView3" android:layout_width="100dp" android:layout_height="100dp" app:srcCompat="@drawable/ic_face" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="32dp" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layouT_Below="@+id/imageView3" android:layout_centerHorizontal="true" android:text="Temp Name" android:textSize="18sp" /> </RelativeLayout> <android.support.v4.view.ViewPager android:id="@+id/viewpager" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.TabLayout android:id="@+id/tab_layout" android:layout_width="match_parent" android:layout_height="wrap_content" app:tabInDicatorColor="@color/colorPriMary"> <android.support.design.widget.TabItem android:layout_width="match_parent" android:layout_height="match_parent" android:text="General" /> <android.support.design.widget.TabItem android:layout_width="match_parent" android:layout_height="match_parent" android:text="Statistics" /> </android.support.design.widget.TabLayout> </android.support.v4.view.ViewPager> </LinearLayout>
这是ViewPager-Content的片段布局:
<!-- TODO: update blank fragment layout --> <LinearLayout xmlns:android="http://scheR_932_11845@as.android.com/apk/res/android" xmlns:tools="http://scheR_932_11845@as.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="TEMP CONTET" android:textSize="20dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="TEMP CONTET" android:textSize="20dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="TEMP CONTET" android:textSize="20dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="TEMP CONTET" android:textSize="20dp" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="TEMP CONTET" android:textSize="20dp" /> </LinearLayout>
提前致谢!
以上是大佬教程为你收集整理的android – 在使用TabLayout和ViewPager的Fragment中启用滚动全部内容,希望文章能够帮你解决android – 在使用TabLayout和ViewPager的Fragment中启用滚动所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。