简体   繁体   English

同一视图上的两个单独的可滚动片段-Android

[英]Two Separate Scrollable Fragments on the Same View - Android

I'm trying to create a basic UI for a simple Temperature Conversion app (new to android developing), and I can't figure out how to create a SINGLE page with two SEPARATE scrollable view pagers, one occupying the top half and the other occupying the bottom one. 我正在尝试为一个简单的Temperature Conversion应用程序创建基本的UI(Android开发人员不熟悉),但我不知道如何用两个SEPARATE滚动视图分页器创建一个SINGLE页面,一个占据上半部分,另一个占据上半部分。占据底部。

I am using Eclipse. 我正在使用Eclipse。 Feel free to ask for any other information required for your answer. 随时要求您提供答案所需的任何其他信息。

This is a rough drawing of what the layout should look like. 这是布局外观的概略图。

在此处输入图片说明

I'm trying to create a basic UI for a simple Temperature Conversion app 我正在尝试为简单的温度转换应用程序创建基本的UI

I do not know why a temperature conversion app would need one ViewPager , let alone two in the same activity at the same time. 我不知道为什么温度转换应用程序需要一个ViewPager ,更不用说同时进行两个活动了。

I can't figure out how to create a SINGLE page with two SEPARATE scrollable view pagers, one occupying the top half and the other occupying the bottom one 我不知道如何用两个单独的可滚动视图分页器创建一个单页,一个占据上半部分,另一个占据下半部分

In terms of the ViewPager s themselves, use a LinearLayout or something to vertically stack them. ViewPager本身而言,请使用LinearLayout或其他东西垂直堆叠它们。

Your bigger headache will come with the PagerAdapter implementations. PagerAdapter实现会带来更大的麻烦。 At least one of these will have to be something other than FragmentPagerAdapter or FragmentStatePagerAdapter . 其中至少之一必须是FragmentPagerAdapterFragmentStatePagerAdapter之外的其他东西。 Those implementations assume that they are the only such adapter for your activity, and I would expect that having two will cause collisions. 这些实现假定它们是您的活动的唯一此类适配器,并且我希望拥有两个适配器会导致冲突。

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

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