i am trying to add a scroll screen layout in my app just similar to main screen scroll of any android mobile. How can i Add such a screen in my activity.
Check the image below.
You can do this by using ViewPager. The ViewPager is also included in the Support library, so you can use it on HC< . It works excactly like this.
There are also custom implementations of the ViewPager, which increases its possibillities e.g.: The ViewPager from Jake Wharton.
This can be done by using "SwipeView"
A SwipeView is an Android UI view similar to the homescreens. You have several similar panes of content that you access by swiping left and right.
You can either go with Android ViewFlow or ViewPagerIndicator
Use Jack Wharton's ViewPagerIndicator, it should work for you.
https://github.com/JakeWharton/Android-ViewPagerIndicator/
Related
I want to show my custom floating button on all screen in my app without putting it in each activity.
Do we have some Global Activity like put a code once will show the Custom View all screen and hide/remove when app killed
I tried lot of things like Screen Overlay display over all apps
Please check code here - How to display custom view on all screen in android from my library
I've never tried to do it the Java/Kotlin way. But have you considered using Fragments?
You can declare xml layout and code for one Activity with a FrameLayout container and an FAB. The container holds all your screens and they switch between each other in the container. The FAB is on top and therefore will be displayed no matter the screen.
The Activity has a reference to any screen that might be displayed in it, so the FAB can behave accordingly.
Not sure if this helps. Perhaps if I see some pictures, I could suggest better.
Related Read:
Creating a fragment: here
Fragment Transactions: here
Some background:
Coming from an iOS background, using UITabbarController is very common and straight forward. Each Tab in the tab controller will change the current view to another UIViewController, and each of these UIViewControllers can have its own NavigationController (which kind of acts as a back stack). So whenever I switch tab, I would resume to the state where I left off.
Now I want to implement the same thing in Android, but it seems like the use of ViewController is different in Android. After digging around, I read that instead of using Activity like UIViewController, I should use Activity to act more like NavigationController, and use Fragments (which is deprecated)
to act as UIViewController instead.
However my question is:
Should I be implementing multiple Activities for Bottom Navigation? When I click on each item in the Bottom Navigation should I use an Intent to change Activity? Because from my understanding, using Intent to change Activity will add the new Activity to an Activity back stack, which would prevent me from switching back to whichever Activity I want. If someone could, Please tell me what is the "right" way (if there is one) to structure Bottom Navigation. Thank you all in advance.
You can use fragments as UIs, And Use a BottomNavigationView in your activity or you can use some libraries.
Here is a library for better customization: https://github.com/ittianyu/BottomNavigationViewEx
Native Method:
https://medium.com/#hitherejoe/exploring-the-android-design-support-library-bottom-navigation-drawer-548de699e8e0
In Android you should use Viewpager, tablayout and Fragments. Just search for its tutorials. there are lots of them on internet
I'm creating an app for both Androids and iOS. In a view, I'm using a pageView as a subview (I mean it doesn't fill all the viewController) in the iOS app.
I need to implement the same thing in Android and I don't know what element I should use.
Here you have an example of a page view.
Thanks for the help.
you can achieve this using view pager
ViewPager Layout manager that allows the user to flip left and right through pages of data. You supply an implementation of a PagerAdapter to generate the pages that the view shows.
follow this link to implement view pager
link 1
link 2
link 3
link 5
The equivalent in Android is a ViewPager.
Use a ViewPager with multiple fragments to get the same effect.
i want to implement FlexibleSpaceWithImageWithViewPagerTabActivity.java in my application. i mean i want to achieve behavior that is shown by this above class. It shows flexible space with image and viewpager with tabs, and has smooth scroll of actionbar with recyclerView.
Here is the code of this class.
i am trying to implement this class. Anybody please help me, how can i use this class or can make my own class having similar behavior.
i have imported this class from this library using gradle. But don't know how to use it.
Thanks in Advance
When using developing Widgets for Android it seems you are not able to add your own custom View classes to a AppWidgetProvider.
For example I created a custom class which extends View, this works fine when used within an Activity but the moment I add it to a Widget I get a "ClassNotFoundException" because Android seems to only allow a set of certain system widgets to be added.
I have seen some apps which look like they have made there own custom widgets. For example there is one that brings up a radial menu when clicked which shows application shortcuts. How are these being implemented? Is there a work around to using my own custom widget? They seem to have a canvas which they are able to draw on within the widget.
Okay quick example https://market.android.com/details?id=zombiesinthelab.widgets.droidpetwidget&feature=top-paid
So this widget is being done by just drawing ImageViews and updating them periodically opposed to using a canvas to draw the frames?
Android Widgets can only contain Layout-Widgets supported by RemoteViews. See this list:
A RemoteViews object (and,
consequently, an App Widget) can
support the following layout classes:
FrameLayout
LinearLayout
RelativeLayout
And the following widget classes:
AnalogClock
Button
Chronometer
ImageButton
ImageView
ProgressBar
TextView
> Descendants of these classes are not
supported.
Pay attention to the last sentence. You can not change this behaviour, it is hard coded in android.
I have not much idea on how to create widgets but following links can definitely help you:
1) http://developer.android.com/guide/topics/appwidgets/index.html
2) http://developer.android.com/guide/practices/ui_guidelines/widget_design.html