简体   繁体   English

在Android中制作可滑动标签页布局的最简单方法

[英]Simplest way to make a swipeable tab layout in Android

I know questions around Tabs and swiping are out there, but a lot of them seem far too involved for what I am trying to do. 我知道围绕制表符和滑动的问题,但是其中许多问题似乎与我尝试执行的工作过于牵连。 Essentially i have two very basic xmls (or i could combine in one if solution allows) that will never change. 本质上,我有两个非常基本的xml(或者,如果解决方案允许的话,我可以合并成一个),它们永远不会改变。

I just need a simple 2 tab layout for each xml (or one is even better if possible). 我只需要为每个xml提供一个简单的2标签布局(或者,如果可能的话,甚至更好)。

The solutions im finding on the web involve, fragments, PagerView and creating multiple activities and classes. 在网络上找到的解决方案涉及片段,PagerView并创建多个活动和类。 It seems all a bit much considering these xmls will never change over the lifetime of the app. 考虑到这些xml在应用程序的生命周期内永远不会改变,似乎有点太多了。 Think, 2 text fields and 2 buttons we are swiping between. 想想,我们在两个文本字段和两个按钮之间滑动。

Any very basic solutions out there? 有没有非常基本的解决方案? Perhaps utilising, ViewAnimator/Switcher somehow with tabs? 也许以某种方式利用选项卡的ViewAnimator / Switcher?

In Android Studio Go to File-> New -> Activity -> Tabbed Activity 在Android Studio中,转到“文件”->“新建”->“活动”->“选项卡式活动”

It will open Tabbed activity 它将打开选项卡式活动

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM