Android ViewPager Fragments - No Swipe and Preloading? - java

I have a pretty standard implementation of ViewPager using Fragments; however I'm wondering if it's possible to get rid of the preloading of tabs, and to only load a tab activity once user clicks on it?
Also, can we get rid of the swipe effect, just like in iOS?
Thank you

If you want the user to only click on tabs, then don't use a ViewPager; put the views in a FrameLayout, make them all invisible and only set the view that is selected visible. When the user clicks on a tab, make the current view invisible and selected view visible. Much simpler than implementing a PagerAdapter.

Related

How to set selectedItem in bottomNavigationView to nothing?

I currently have a bottom navigation with 3 items for my 3 activities. I have a separate button on one of the screens that opens a new activity. When this happens, I'd like to program it so none of the 3 options of the bottom navigation view are selected.
bottomNavigationView.setSelectedItemId(R.id.______)
This is the line I use to select which icon I'd like to be shown as currently clicked. If I leave this line out of my activity, the first item of the bottom navigation view is selected by default.
I think that it will be better for you to use fragments for this task.

making a View like Fragment Drawer

I would like to make a Fragment show up just like a Fragment Drawer would, but not only to a list of intents.
(If you don't know what I mean by Fragment Drawer):
Google products such as Gmail, "Google app", Google Play... utilize them frequently.
The Fragment Drawer is a menu on one of these apps created by swiping from left to right or clicking the "Hamburger" button.
I would like to highlight the distinction between what I want and the Fragment Drawer is: I would like to be able to place TextViews, ImageViews, and Buttons inside of it as if it were a normal fragment in which I could just inflate a layout in it and I would rather it come from the right instead.
If a visual representation is needed I would be happy to try my hand at making one.

Scrollable Views Interacting with other child views like Google street View

I intend achieving a layout similar to what is shown.
I have tried achieving similar behavior with Bottom sheet, percentFrameLayout, ScrollView and Coordinated layout on different occasions, but I've not being able to achieve something similar to the view that (possibly a fragment) that is scroll from the bottom of the screen and interact with other child views on the screen like the tab and the refresh button.
Any guideline and directions on how i can do this ?
You can use a RecyclerView for the cards and leave your toolbar and main content on a FrameLayout at the same level as the map. And of course a coordinator layout and proper behaviors on each element.
By doing this your recycler view will be able to interact with the toolbar and still be independent from the map.
In other words, you can reduce your problem to a single recyclerview scroll with a toolbar by making a space on the beginning of the vertical recyclerView.

Apply navigation drawer show/hide mecanism to sidebar layout

I have a layout at the right side of the screen that I would like to hide and show by dragging in a navigation drawer fashion but I don't want it to be a navigation layout, just the usual layout. Can this be done? How exactly?
Yes this can be done. One way would be to implement gestures. (http://developer.android.com/training/gestures/detector.html) Probably overriding and using onScroll would work best. Basically when that method is called you can then either animate the navigation view into the current view port, or adjust the view location as you drag left/right.

Android list view inside tab focus issue

I have a TabHost with a ListView inside a tab. When the activity starts, I can't scroll the list view until I have clicked off the tab that the activity starts on, and then re-select the tab with the list view inside it.
Note, I can get the list view to focus by calling:
tabHost.getTabContentView().requestFocus(); but unfortunately, I still can't scroll until I have reselected the tab...
Have any remedies?
Thanks!
Fixed - I ditched the tabs in order to simplify the layout.

Categories