Honeycomb Gmail as an application

Does anyone know (or can show me an example) how I can develop an application that behaves the same as cellular gmail? How can I switch between the layouts of the frames and resize them to display the content. for example, when you click on your message, and then the fragment floats to the left to make room for the message, and the fragment of se containing you disappears.

+6
source share
1 answer

I think you are all sad :). Provide a layout for your components, I would suggest a LinearLayout with a horizontal orientation. Then you add all three fragments to it, and you hide the third containing the message.

FolderListFragment folderListFragment = new FolderListFragment(); MessageListFragment messageListFragment = new MessageListFragment(); MessageFragment messageFragment = new MessageFragment(); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.add(container_view_layout, folderListFragment); ft.add(container_view_layout, messageListFragment); ft.add(container_view_layout, messageFragment); ft.hide(messageFragment); ft.commit(); 

Then, when you want to show a snippet of message:

 void showMessage(Message message) { // Initialize messageFragment messageFragment.setMessage(message); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left); ft.hide(folderListFragment); ft.show(messageFragment); ft.commit(); } void showFolders() { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right); ft.hide(folderListFragment); ft.show(messageFragment); ft.commit(); } 

And for animations, there will be slide_in_left for the folder fragment, you can get the rest (400 is the width of the component):

 <set> <objectAnimator android:propertyName="x" android:duration="500" android:valueFrom="-400" android:valueTo="0" android:valueType="intType"/> </set> 
+6
source

Source: https://habr.com/ru/post/899851/


All Articles