How to make side-scrollable screens in Android? - android

I am trying to practice different functionalities in Android using Android Studio.
Right now I wish to make it so I can swipe left/right between various components.
A good example of this is the app called Simple Workout Log. The top bar is scrollable (in a more localized way) whereas the bottom of the screen scrolls over entirely with each swipe.
I did notice something called HorizontalScrollView in Android Studio but couldn't figure out how to mimic the functionality.
How is something like this made?

Create tabbed activity and it will automatically implement view pager and FragmentPagerAdapter for you.
After that you can look up for tutorials on creating tabs using frgments such as this one

Related

Switching between activities Android

I have an Android app with two classes:
-MainActivity
-SecondActivity
I have also two layouts for these classes (they are pretty similar).
I want to switch between these activities by 'shifting' to the right or to the left.
All materials I find are about switching by button.
Anyone would recommend using Fragments and ViewPager instead of Activity since you want sliding action and make use of the Android TabLayout.
Here is a tutorial that you can draw a basic idea from.

Android ViewPager non-title page indicator

I'm using a ViewPager to host multiple views, and I want something to visually show where the user is currently located. I don't want to use PagerTitleStrip or PagerTabStrip cause I don't want titles.
I want something similar to the horizontal line in the default launcher of the Nexus 4 shown in here:
When you swipe left or right, there is a slightly bigger rectangle that shows your position relative to the pages.
How can I do this?
PS: I can't use any library cause the code is going to be written in C# with Xamarin, also can't use any Xamarin component cause license won't let it have any more components.
Use the ViewPagerIndicator Library. This has an option for your desire.
ADDITION
I found this official Xamarin ViewPagerIndicator Library. Maybe this would help.

iOS Tab Replacement in Android

What is complete replacement of iOS Tabs Replacement in Android.
I Know that Android is Android and we don't Imitate other platforms on Android. I have Studied Pure Android
But All I want to have the replacment of iOS tabs in Android with following features.
1.) Stores Navigation flow for each tab, As in iOS there is navigation controller for each tab and we can have the previous state for each tab while switching from tab to tab.
2.) Desirable but not necessary- Double click on tab button will refresh the view with the root view as per in iOS.
3.) The animation while switching from tab to tab or with in Tab does not swipe the complete Tabs(including the TAB Bar). It means only the content of each Tab should be replaceable with separate Activity or something like this.
4.) In short User Experience must be similar to iOS Tab Bar.
What I have Tried so far.
1.) Added Tabs with TabHost on bottom of screen.But I Haven't got the stack navigation for each Tab separately.
(Something like: https://github.com/AdilSoomro/Iphone-Tab-in-Android)
2.) Also I have an idea of Using Stack (Java Collection Framework.) But that will be a headache to maintain all the stack by my self.
So, Guys In short:
Do you have any ideas of any Third Party Library, that I can use in my project without much problem to achieve all the features mentioned above?
Any help would be appreciated.
Thanks.
This one is best to implement iOS like tabs in Android
Like this:
You can use the native tabs and style it to seem like iOS ones.
Use Fragments, and store/reload the "Natigation flow" at the onPause/onRestore methods in each Fragment or in the FragmentActivity when you change form one fragment to an other.
BTW, please don't do that. If you studied Pure Android, what's the point do you want to achieve? Android is Android and iOS is iOS, do not mix them please.
UPDATE: 3 September 2017
An other, and imho better, approach to do so is make use of the Bottom Navigation. Take a look to materialdocs to learn how to use it.

Tips on how to build a layout like this one

Could anyone give me a tip on how to build a layout like in the following picture?
The application i'm working on has absolutely nothing to do with VoIP but I'm trying to build something like this. One fixed toolbar at the bottom, an interchangeable middle pane with listviews, scrollviews or other, and another toolbar at the top which would change depending on the button selected on the bottom bar.
Also, would it be possible and good practice to keep all of this within a single activity?
You should NOT build an interface like this. Don't use bottom bars! Don't use labelled back buttons on action views!
You should read the Android design guidelines and then work with tab views... and other stuff referenced there and build an Android app.
Also, would it be possible and good practice to keep all of this within a single activity?
-Yes for sure, and yes with a slight catch, depending on what you mean.
One approach would be to create your top and bottom bars inside their own XML. Then in your activity onCreate() inflate and add at the top and bottom of your Layout.
If the bottom bar will not change ever, then you could actually add that into the layouts you already have. If you do it that way, to handle the listeners you could create an Activity that contains just the bottom bar click listeners and then extend that with all of your other activities.
Since the top bar can change though you'll probably have to inflate and add the views to that at run time, that way you can react to what is going on to add / remove / present the appropriate views in the top bar.
Also just because it is somewhat of a pet peeve of mine:
When designing your bottom bar please seriously consider the fact that some devices have soft buttons directly underneath the touch screen. And they are rather close to the screen on some devices. Applications with a bottom bar that is not tall enough create an opportunity for the user to hit one of the system buttons instead of one of the bottom bar buttons as they are intending (or vice versa). Which from a users perspective I must say is VERY aggravating.
Do not use bottom bars. To give a more familiar UI, put all of those functions into the top bar. Start by looking at the source code for the ActionBarCompat project in your android sdk sample folder.
The Android developer site is a good place to start. See
UI Guide
I also agree with the poster who recommended against this specific layout. It seems to have been developed for an iPhone and shouldn't be used "as is".

Android Tweetdeck-like UI

I'm getting started with Android development, and I would like to have an interface similar to that of tweetdeck: there are several workspaces (activities) that are laid out left to right, and the user can switch between them with a horizontal gesture. The same way the Android desktops are switched.
In tweetdeck there are also dots in the titlebar, that indicate on which side and how many workspaces there are.
Is it a standard Android interface, or something custom built? How do I do something like this?
How you go about this is going to be partially dependent on the content you want to present. If there are going to be many heavyweight pages you'll want to look into doing something like a custom AdapterView. If there are only a few fixed pages such as in the stock home screen you can treat it like a scrollable view with some custom logic to handle snapping to pages.
Here's a link to the custom view that implements this in the stock Android launcher. The bits you're interested in will mostly be in onTouchEvent, onInterceptTouchEvent, and computeScroll.
https://android.googlesource.com/platform/packages/apps/Launcher2/+/master/src/com/android/launcher2/Workspace.java
Take a look at ViewFlipper: http://developer.android.com/reference/android/widget/ViewFlipper.html
In addition to studying the actual Android code (referenced in another answer), some folks have extracted and isolated the workspace (Launcher2) code into a re-usable view group. You can find the work in github here https://github.com/olibye/AndroViews

Categories

Resources