- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试使用 fragment 重现 Honeycomb GMail UI,但不能。这就是我想要的
初始状态:
+--------+---------------+
| | |
|Accounts| Folders |
| | |
+--------+---------------+
选择文件夹后:
+--------+---------------+
| | |
|Folders | Items |
| | |
+--------+---------------+
其中帐户、文件夹和项目是 fragment 。 (显然后退按钮应该进入初始状态)
我尝试了以下布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:id="@+id/root">
<FrameLayout
android:id="@+id/left_pane" android:layout_weight="1"
android:layout_width="0px" android:layout_height="match_parent" />
<FrameLayout
android:id="@+id/right_pane" android:layout_weight="1.6"
android:layout_width="0px" android:layout_height="match_parent" />
</LinearLayout>
不幸的是,这不起作用,因为我无法将我的文件夹 fragment 从右 Pane 移动到左 Pane ( fragment 只能添加一次)。我可以改为创建新文件夹,但这非常浪费资源,需要仔细的状态管理(尤其是当按下后退按钮时)并且看起来不像我想要的样子。
我尝试使用 3 个 FrameLayout(左、中、右,权重分别为 1、1.6、2.56),但我无法在 fragment 未显示时折叠 FrameLayout。非常感谢任何帮助
最佳答案
按照 Nicholas 的帖子建议使用三帧布局在我的应用程序中效果很好。为了保持正确的比例,您可能需要动态更改布局权重(尽管我认为不这样做是可能的)。我使用这个辅助方法来处理所有这些逻辑。请注意,它需要几个助手;一般来说,从他们的名字应该很清楚那些需要做什么,所以我没有把它们贴在这里。不过,有一件事是我有一个包含所有框架持有者的成员数组,因此此方法可以自动隐藏任何不需要的东西。
final private void showFrames(View leftFrame, View rightFrame) {
// Hide frames that should be gone
for (View frame : mContentFrames) {
if (frame != leftFrame && frame != rightFrame) {
frame.setVisibility(View.GONE);
Fragment frag = getFragmentManager().findFragmentById(frame.getId());
if (frag != null) {
getFragmentTransaction().remove(frag);
}
}
}
// Set up the left frame
if (leftFrame != null) {
leftFrame.setVisibility(View.VISIBLE);
leftFrame.setLayoutParams(new LayoutParams(0, LayoutParams.FILL_PARENT, 3));
}
// Set up the right frame
if (rightFrame != null) {
rightFrame.setVisibility(View.VISIBLE);
rightFrame.setLayoutParams(new LayoutParams(0, LayoutParams.FILL_PARENT, 7));
}
// TODO: set up animation
// Start the transition
commitTransition();
}
希望对您有所帮助!--兰迪
关于android - 使用 fragment 重现 Honeycomb GMail UI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5811922/
这是在 https://stackoverflow.com/questions/12639454/make-scalacheck-tests-deterministic 中作为“奖金问题”提出的,但没
我的项目使用 Angular 6 和 Leaflet 1.2。 我想重现当用户在 Leaflet map 上保持右键或左键单击时的拖动效果。例如,我希望在不断按下空格键时能够开始拖动 map 。 我已
我们正在将我们的用户身份验证从提供的 .NET 实现迁移到我们自己的系统。 我们希望能够支持存在于 aspNet_Membership 表中的旧密码。 Password 和 Salt 位于该表中,因此
我有一个二进制文件,它在 99% 的时间里都运行良好。有时,我无法理解,它会因这个输出而崩溃。在我重新启动之后,一切正常。 二进制是一个模板系统。它读取了一些带有占位符的模板,例如{%foo%} 或
我试图在 c 中重现 strcpy 的行为,我的问题是该函数有效但它在末尾附加了额外的东西。 char *ft_strcpy(char * dst, const char * src) { in
我最近遇到了可怕的 UserPreferenceChanged 事件 UI 卡住问题,随后我解决了可能的原因,例如: 调用单个控件而不是主应用程序表单(参见 https://stackoverflow
在 Scala 编程中,我可以读到 ==运算符的行为就像是这样定义的: final def == (that: Any): Boolean = if (null eq this) {null eq t
我正在和我的 friend 一起开发 Django 项目。该项目依赖于一些 python 模块。我在 virtualenv 中安装了 django 和其他依赖项。 django 项目的代码位于一个存储
关于spark的大多数问题都使用show作为代码示例,没有生成数据帧的代码,如下所示: df.show() +-------+--------+----------+ |USER_ID|locatio
我正在尝试重现 java.lang.OutOfMemoryError: unable to create new native thread但是使用 -Xss VM 参数。我猜想如果我们有大量线程,并
我正在尝试在自定义 alertView 中插入表格 View 。我需要实现与默认警报相同的样式。从 Debug View Hierarchy 我几乎复制了样式,但我无法弄清楚 Apple 如何设置模糊
标准是否保证如果 std::mt19937 被相同的数字播种,它会在所有平台上产生相同的数字序列? 换句话说,它的实现是否由标准明确定义,或者像 std::rand() 一样被视为实现细节? 最佳答案
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的
我有一个网站可以从 BingPreview/1.0b* 获得访问,这很可能是 Bing 的机器人。 我收到一个错误,它似乎无法找到我非常确定应该存在的 DOM 元素。我没有从任何其他浏览器(在所有主要
有谁知道如何重现 new Notes new scanning feature在 iOS 11 中?? AVFoundation 是否用于相机? 摄像头如何检测纸张/文档/卡片的形状? 他们如何实时放
您好! 作为使用 Objective-C 开发 iPhone 应用程序的初学者,我想知道重新创建 iPhone SMS 应用程序 UI(带有消息气泡等的用户界面)的最简单方法是什么 我考虑过将 UIT
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: How can the built-in range function take a single argu
虽然这很可能是我自己犯的错误,但有人可以帮助我。我有一个包含 6 个数据点的极坐标图,在绘制时仅显示 5 个数据点。如果这是一个问题,我会在 GitHub 上打开 1,但我在想,如果它归结于我糟糕的代
我正在尝试使用 rCharts 重现简单的示例绘图库 sankey图表。我发现this example from scratch并尝试重现它,但是,我遇到了一些问题。 首先,我尝试在没有任何内容的情况
进入 Haskell,我试图重现 numpy's reshape 之类的东西与列表。具体来说,给定一个平面列表,将其 reshape 为一个 n 维列表: import numpy as np a =
我是一名优秀的程序员,十分优秀!