Android TabLayout和Fragments(Android TabLayout and Fragments)

编程入门 行业动态 更新时间:2024-10-28 09:18:18
Android TabLayout和Fragments(Android TabLayout and Fragments)

我已经学习Android几个月但我有几个问题我找不到解决方案。 最近,我按照一些教程解释了TabLayout,Fragments和RecyclerView,但这对我来说不值得。 我需要一个Android界面,其中有几个标签,内容不同,但我需要的是启用滚动。 这是我的代码:

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/coordinator_main_content" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:layout_scrollFlags="scroll|enterAlways" /> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" />

I have been learning Android for a few months but I have several questions I can't find solution. Recently, I follow a few tutorials where there explain about TabLayout, Fragments and RecyclerView but that is not worth for me. I need an Android interface which a few tabs, with diferent content, but what I need is to enable scroll. This is my code:

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/coordinator_main_content" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.AppBarLayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.design.widget.TabLayout android:id="@+id/tabs" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:layout_scrollFlags="scroll|enterAlways" /> </android.support.design.widget.AppBarLayout> <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior" />

最满意答案

解决方案:要解决此问题,我们必须使用NestedScrollView

SOLUTION: To fix this, we have to use NestedScrollView

更多推荐

本文发布于:2023-07-18 10:03:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1158579.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Android   TabLayout   Fragments

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!