I have a tab, at the bottom of the page, 4 items in the tab. When I click an item in a tab a new page animates(like in parallax animation) from bottom to the top with this tab layout as the top item. How can I do this. Is it possible with contraintLayout?
use FrameLayout which will act as fragment container and perform fragment transaction to stick fragment inside frame layout when user click on bottom tab item.
Further you can also perform animations like bottom_up animation with that particular fragment.Make sure you are using that frame layout within activity_main.xml inside parent view where you want to show your animation.
Related
I have a sliding pane layout with a listview on the left, and a pane with my fragments on the right. When I click the listview items, my fragment correctly loads in the right side pane. The user then needs to slide the pane to bring it to the forefront. I would like the pane to automatically slide to the forefront when the user clicks the listview item, instead of having to manually slide it.
This is where I load my fragment into the side frame. Again, this is working 'correctly', but not with the functionality I am looking for.
fragmentManager.beginTransaction()
.replace(R.id.frame_to_be_replaced, fragment)
.commit();
I think you may be hiding the fragment because the replace and commit methods should immediately show the fragment. Try this for now, FragmentTransaction.show() method.
Let me brief about my idea and what I'm aiming to achieve,
Idea is to have a swipe tab with three tabs in it and each tab screen being represented by a seperate Fragment class. I did this using the "it.neokree:MaterialTabs:0.11" library and everything is working well.
Then I created a floating action button (FAB) using the "com.oguzdev:CircularFloatingActionMenu:1.0.2" library.
Now what I'm trying to achieve is to fix this FAB to the fragment in the center tab and when I swipe the screen to go the previous or the next tab the FAB should slide out along with the tab fragment its in and should slide back in along with the center tab screen when I swipe back to it.
I have worked on it till now and now I'm able hide the view in other fragments and show it again in the center fragment by overriding the setUserVisibleHint() method in each fragment class like this.
#Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) {
View tempView = getActivity().findViewById(R.id.myFAB);
tempView.setVisibility(View.INVISIBLE);
}
}
But the problem is I want the FAB to slide out and in along with the center tab just like other views in the tab's fragment class does, but my FAB is simply vanishing and reappearring.
In a way I want the FAB to be exclusive to the center tab and should be fixed to it.
I also tried defining the FAB inside the center Fragment class but it doesn't seem to make any difference. Any Advice and suggestion will be very helpful. Thanks in advance
This library adds it's view to the 'android.R.id.content' ViewGroup. That's why it doesn't matter, where you define it.
Animating such view may be difficult, but should be possible. You have translate the FAB while swiping the pager manually.
By the way, Google recommends to hide the FAB, not swipe:
For tabbed screens, the floating action button should not exit the
screen in the same direction as the screen exits. Doing so creates
visual noise. It would also cause a nonfunctional floating action
button to appear on screen. Furthermore, it incorrectly implies that
the floating action button is at the same the z-level as the content,
rather than at the level of the primary UI elements at the root
level.
See: http://www.google.com/design/spec/components/buttons-floating-action-button.html#buttons-floating-action-button-behavior
If you want to show the FloatingActionButton only in the middle/single tab, then you can add the FAB in the Fragment instead of adding it in Activity in which all the Fragments are added.
I have a detail screen which is fragment, in middle of it I have a linear layout with 2 textViews. I want to slide a map view from right of screen over the linear layout using a button, see picture below:
Anyone can help please?
You can consider using Android ViewPager to slide the map fragment back and forth over your textView.
Here is a tutorial if you want to start.
I'm using sliding pane layout in my project. When it was in its closed state i tried to click on an empty space of my fragment's layout, but the click was performed on another fragment (which should be shown only when sliding pane layout is in open state), like it's on the top of the screen. It looks like empty RelativeLayout's space is transparent for clicking. Is there a bug or am I doing wrong something?
I have work on sliding menu. I have some problem of this sliding menu.
This is 3 frame layout. and i have Require slide center frame layout like this.
This is my second layout. how can i make this second layout?
Issue is: I have required second screen but in the second layout all frame are slide in right side. My requirement is only second frame move right side.