如何实现一个固定的左窗格中的Andr​​oid平板电脑的布局? [英] How do you implement a fixed left pane for an Android tablet layout?

查看:127
本文介绍了如何实现一个固定的左窗格中的Andr​​oid平板电脑的布局?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我移植了iPhone + iPad应用程序到Android。它采用了分离视图控制器为片剂,其在Android中的行话,您可以present两项活动并排同时(编辑:机器人只允许在屏幕上一个活动所提到的以下@commonsware下一个最好的办法是用碎片,但操作栏可以在活动水平只存在,这意味着它必须扩大屏幕的整个宽度,它不知道是否拆分活动控制器将来到了Android平台。)

在平板景观布局有一个固定的左窗格中的统计数据,永远不会改变。在右侧窗格的功能就像应用程序的手机版本。转换只发生在右侧窗格中。即改变活动时,整个屏幕不滑,只有右窗格中。你会如何​​建议在Android中实现这一点?

我应该使用一个单一的活动,并手动执行片段之间的转换在右侧面板中?这个程序有25个屏幕,并有手机备用的布局,所以我想未雨绸缪,做​​到这一点在第一时间:)感谢您的帮助!

解决方案
  

它采用了分离视图控制器为片剂,其在Android的行话同时,您可以present两项活动相映成趣。

没有。在Android的行话,你不能present两项活动并排同时。您的可以的present两个片段并列同时进行。

  

你会如何建议在Android中实现这一点?

使用的片段。使用 FragmentTransaction 来代替右手片段需要根据用户的输入。你的整体活动布局可以有一个水平的LinearLayout (用的android:layout_weight 控制尺寸为左,右两侧),用<片断> 元素的左侧和的FrameLayout 的权利

  

我应该使用一个单一的活动,并手动执行片段之间的转换在右侧面板中?

是的,要达到你的要求。

I'm porting an iPhone+iPad app to Android. It uses a Split View Controller for tablets which in Android lingo allows you to present two Activities side by side simultaneously (Edit: Android only allows one Activity on screen as mentioned by @commonsware below. The next best thing is to use fragments, but the Action Bar can only exist at the Activity level, meaning it will have to expand the entire width of the screen. It wonder if a Split Activity Controller will be coming to the Android Platform.)

The tablet landscape layout has a fixed left pane for statistics that never changes. The right hand pane functions just like the phone version of the app. Transitions occur exclusively on the right hand pane. i.e. the whole screen doesn't slide when changing activities, only the right pane. How would you recommend implementing this in Android?

Should I use a single activity and manually perform transitions between fragments in the right panel? This app has 25 screens and will have an alternate layout for phones, so I'm trying to plan ahead and do this right the first time :) Thanks for your help!

解决方案

It uses a Split View Controller for tablets which in Android lingo allows you to present two Activities side by side simultaneously.

No. In "Android lingo", you cannot "present two Activities side by side simultaneously". You can present two fragments side by side simultaneously.

How would you recommend implementing this in Android?

Use fragments. Use a FragmentTransaction to replace the right-hand fragment as needed based on user input. Your overall activity layout could have a horizontal LinearLayout (with android:layout_weight to control the sizes for the left and right sides), with a <fragment> element for the left and a FrameLayout for the right.

Should I use a single activity and manually perform transitions between fragments in the right panel?

Yes, to achieve what you ask for.

这篇关于如何实现一个固定的左窗格中的Andr​​oid平板电脑的布局?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆