0

I have created application for taking photos. Application is tab-based. One tab is for camera. It has a layout, let's call it "Camera layout". After user presses "Photo" button from "Camera layout", that same tab should change it's content to "Photo preview" layout. I do it using "setContentView". The problem is that "setContentView" will change layout for good! Next time user opens "Camera" tab i would like to show him good old "Camera layout". How to do it?

P.S. "Photo preview" has no, and (for specific reasons) can't have any button that will "save the photo and put back old content".

4

1 回答 1

0

你的标签在哪里?是使用碎片吗?您可以采取以下几种方法:

// 如果布局 ->

A) 具有双重布局,作为 FrameLayout 父级,具有两个子级布局,可以在“可见”和“不可见”之间进行更改。当您的用户单击按钮时,隐藏 CameraLayout 并显示 PhotoPreview。在 CameraLayout 之后反之亦然。

B)将您的 PhotoPreview 实现为显示预览的对话框。它将占据屏幕的大部分(或整个屏幕,取决于您的自定义),并且不会改变其他屏幕布局。

// 如果片段 ->

A)当用户返回您的 CameraLayout 时,实际上重新创建您的片段(我假设您的意思是一个选项卡式碎片应用程序)。

B)在它的两种不同状态之间替换您的片段,在 CameraLayout 和 PhotoPreview 之间切换。

于 2013-10-08T21:31:07.163 回答