Navigating between activities in android - android

Can someone tell me how do the following works:
in an application there are something like header with titles. So you can scroll the screen down to see all its information and then throw it to the left and see another screen, like with messages.
This functionality of vk.com

Sounds like what you are after is a ListFragment and a Fragment used with a ViewPager.
The ViewPager gives you the funcionality of swiping left and right, and the Fragment class is a really good way of implementing things, since they are reusable and can be placed in different activities.

have you tried to use ViewPager? You can see it's functionality in Play store application.

You need use class ViewPager. My advice - use fragment.

Related

Creating a "swipe" animation when inflating a fragment

I'm trying to implement a "swipe" animation when opening a fragment.
Right now When the fragment is being shown from my MainActivity the fragment is being scrolled down (top-to-bottom), going over and covering the Activity.
What I'm trying to achieve is that instead of the fragment being rolled on top of the activity I want it to "push" the activity out of the way on its way down. Similar to how ViewPager animations work.
Here is a rough sketch of what I'm trying to achieve
From my limited experience with ViewPager, it can be used to "Swipe" between multiple activities OR multiple fragments, and you cannot mix & match.
Does anyone have an elegant solution on how to achieve this?
I really don't want to convert MainActivity into a fragment because there are tons and tons of code there.
Thanks in advance <3
In this case you need a BackDrop component.
for more information see the website below:
material.io
but there is no proper implementation in android you must implement this component by your own
you can use these website below to implement this component
medium.com
github.com

Android implement left to right swipe animation

In android, i want to move from current to previous activity by left to right swipe as in iOS. I want to be able to even hold while swiping such as both activities are visible at the same time.
I want to introduce transition/animation effect just like in Telegram app. So please help how can i do it.
Tutorials or example code will work for me.
Thanks in advance!
You better use the Swipe animation with multiple Fragments inside one Activity: Creating Swipe Views with Tabs
take a look at this tutorial : HOW TO IMPLEMENT HORIZONTAL VIEW SWIPING WITH TABS
If you're already using Google's NavComponent library, you should try a library that I wrote:
https://github.com/massivemadness/Fragula
It's fully integrated with NavComponent, which means the navigation API stays the same, you only need to make some changes in NavGraph and NavHost container.
Here's the result:

Display part on another Activity (or Fragment?) Android

I have to deal with two ActionBar displayed at the same time on the screen. There's an onClickListener on the second one which allows the second activity to be shown on the entire screen after a click, with an animation.
I have no idea how to do that. Two activies, fragments? ViewPager? ... Absolutely no idea. Could you please help me? Thank you.
EDIT : here is a picture of what I wanna achieve http://romainpellerin.eu/so_android.png
You have to see it in order to clearly understand my problem.
Definitely Fragments.
When you bring in the second fragment specify animations in the fragment transaction before you commit it.
There are tons of tutorials online. Here some more help.
Android Fragments and animation
SDK
http://developer.android.com/guide/components/fragments.html
how to make fragments backwards compatible
http://developer.android.com/training/basics/fragments/support-lib.html

Android implementing fragments with a viewpager

I'm considering modifing my app using fragments with a viewpager, instead of activities.
So, as I understand the situation, I should be able to modify my app, that it just contains one main-activity which contains viewpager and to this viewpager I can and and remove Fragments as I like it, is that correct?
If I am correct has someone maybe a link with a short example implementation (main-class + methods for adding and removing fragments)....
If I am not correct can someone give me a hint what the cleanest implementation for such a problem would be.
Already thanks for your time and support.
Check out the example on the ViewPager documentation it shows the usage with Fragments:
https://developer.android.com/reference/android/support/v4/view/ViewPager.html

Android Layout Fragment/Activity Confusion

I am making my first android application with the ActionBarSherlock.
The application will always have an action bar consisting of 3 tabs (first tab selected by default).
The app could be extended for use with a tablet.
I have been searching the web, and following the android development guides, however I am finding a few things confusing.
The first tab screen will be a list view with a list of items, onitemselected should send the user to a screen which features more details about that item.
When should I use a fragment? Should each tab be a fragment?
Or, should each tab call a new activity, which consists of fragments?
And, if using fragments, should I place them in different classes, or embed them within an activity??
Appreciate any help, thanks.
you should probably read these two links first.
http://android-developers.blogspot.com/2011/09/preparing-for-handsets.html
http://android-developers.blogspot.com/2011/02/android-30-fragments-api.html
If you plan to make an app that work on both phone and tablet. It is a good idea to use a fragment, and then use a shell activity to wrap that fragment.
My experience with Fragments is mostly on ViewPager, so I am not entirely sure if it applies here.
In Android, you should use Fragments as much as possible. As a general rule of thumb, imagine you are translating the UI from phones to tablets, elements that can stay together in the same configuration should be a Fragment.
There is a Fragment subclass called ListFragment, so you might want to look into that for your first tab. (ListFragment is for Fragment like ListActivity is for Activity)
There is also a tutorial I found to deal with fragments. Did not really look into it but I hope it helps.
http://android.codeandmagic.org/2011/07/android-tabs-with-fragments/
As for ActionBar / ActionBarSherlock, I have absolutely no experience withit so someone might want to add to that.

Categories

Resources