Android Honeycomb:布局问题 - 隐藏/显示 FrameLayouts
Layout 1 Layout2
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
我的 2 个片段的初始布局就像图片(布局 1)一样,
线性布局内有 2 个框架布局,它们在运行时被填充 与碎片。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout android:id="@+id/frame_fragment"
android:layout_weight="1" android:layout_width="0px"
android:layout_height="fill_parent" />
<FrameLayout android:id="@+id/frame_map"
android:layout_weight="3" android:layout_width="0px"
android:paddingLeft="2dip"
android:layout_height="fill_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/screen" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
</RelativeLayout>
</FrameLayout>
</LinearLayout>
我想在布局 1 <-> 之间切换布局 2。
目前的实现方式如下:
FragmentTransaction transaction = getSupportFragmentManager()
.beginTransaction();
transaction.setCustomAnimations(android.R.anim.fade_in,
android.R.anim.fade_out);
Fragment fragment = getSupportFragmentManager().findFragmentById(id);
if (fragment.isHidden()) {
transaction.show(fragment);
} else {
transaction.hide(fragment);
}
transaction.commit();
隐藏/显示作品 - 但不会将剩余片段/帧布局调整为全屏 (A)
如何使剩余片段填充整个屏幕区域? 我是否有其他布局或者我是否必须强制(如何?)重新布局?
谢谢任何输入
Layout 1 Layout2
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
The initial layout of my 2 fragments is like picture (Layout1)
there are 2 framelayouts inside a linearlayout which get filled at runtime
with fragments.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout android:id="@+id/frame_fragment"
android:layout_weight="1" android:layout_width="0px"
android:layout_height="fill_parent" />
<FrameLayout android:id="@+id/frame_map"
android:layout_weight="3" android:layout_width="0px"
android:paddingLeft="2dip"
android:layout_height="fill_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/screen" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
</RelativeLayout>
</FrameLayout>
</LinearLayout>
I want to switch between Layout 1 <-> Layout 2.
This is currently implemented like this:
FragmentTransaction transaction = getSupportFragmentManager()
.beginTransaction();
transaction.setCustomAnimations(android.R.anim.fade_in,
android.R.anim.fade_out);
Fragment fragment = getSupportFragmentManager().findFragmentById(id);
if (fragment.isHidden()) {
transaction.show(fragment);
} else {
transaction.hide(fragment);
}
transaction.commit();
hiding / showing works - but does not resize the remaining fragment/framelayout to fullscreen (A)
How can I make the the remaining fragment filling the whole screen area ?
Do I have another layout or do I have to force (how?) a relayout ?
thx for any input
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用这样的参数怎么样?
How about using parameters like this?