Is it possible to set this ViewPager without libraries? - android

I want to achieve this layout style in ViewPager:
I understand it's easy to implement using ViewPagerIndicator(http://viewpagerindicator.com/), but I want to avoid using external libraries in my project
I've read documentation: http://developer.android.com/design/building-blocks/tabs.html but I can't find out how to set the style of the Tabs to the one that I'm showing you in screenshot. However, this is implemented in Android Settings - Applications, so I guess it's somehow easy to implement with SDK code.
Any tips?
Thanks!

With help from MuhammadA, I figured out how to do it:
Browse sourcecode from this example in Google Documentation: http://developer.android.com/shareables/training/EffectiveNavigation.zip
Check code from Activity: CollectionDemoActivity
Seems easy to implement!

Related

What is the best Compose way to build preference screens without using a fragment?

I was unable to find any documentation on how to create preference screens in a pure Compose way without using a fragment.
Can anyone please suggest the best way to make a preference screen without using a fragment with an example? Or should we stick with the fragment way for that?
Thanks for your help!
I have implemented my handmade settings screen for jetpack compose. This is a sample of my app using it. I know that this is isn't perfect but here is the link anyway if you want to try it:
My repository
You can compose it. 🤗
A good example from the Jetnews study app:
You can also use third-party libraries like Compose-Settings if prefer.

How to implement something like this in an android application?

I'm looking for the right and convenient way to create this item. I spent many hours on the internet and still have not found anything like it on the android. Thank you in advance.
If you would like to use Android native library i suggest TabLayout, with a ViewPager.
It will allow you to have one tab selected at a time, and have the animation when you slide to the next tab.
This is just an example that you can take a look at: https://android.jlelse.eu/tablayout-and-viewpager-in-your-android-app-738b8840c38a
There are also some custom libraries that will maybe give a better animation or something like that but i suggest you first try this before trying 3rd party libs.

Tab Layout with Sliding Views

I want to create an app that uses a tab layout with sliding views (something like this):
Here's the issue:
I searched all over the web for a guide that could explain how to do this kind of thing but all I tried didn't work for me. I read somewhere that tabs layout is deprecated with Lollipop, so I tried to find an alternative way to do what I wanted to do, but nothing. Every tab layout app I try to create ends up with a crash while testing and I think it's due to something about the ActionBar, always because of the ActionBar Tabs are deprecated in Lollipop. I'm not going to post any code because I created so many projects that I lost their count, and also because they are quite the same.
So, anyone could please link me a guide or explain a working method that allows to do what I explained?
All I can say is that the app has to be used on Lollipop, so I'd like to know the compile settings to put in the gradle files.
Another important thing is that i use Android Studio, even if most of the tutorials i find on web are about Eclipse.
I hope to have explained in detail my problem and what i want to do and i thank you all in advance.
Here is a detailled description of how to use the SlidingTabLayout like Google uses it in the Store:
https://github.com/codepath/android_guides/wiki/Google-Play-Style-Tabs-using-SlidingTabLayout
Like Hugo already mentioned: it works with viewpager

App browsing page bar

Im developing an app and wanted to add some page browsing with those dots to identify your current page like the image below, can someone tell me how is that control called?
Thank you in advance
There is nothing in the Android SDK that provides this "out of the box". It is probably implemented as a LinearLayout holding ImageView widgets, though there are plenty of ways of doing it. If your intention is to use this with a ViewPager, there is an implementation of this UI in the ViewPagerIndicator library and perhaps in other open source libraries as well.
If you really want to see what that app is doing, use uiautomatorviewer to inspect the running UI of that activity and see what widgets are involved.
There is no default Android view for that.
Take a look at this:
https://github.com/JakeWharton/Android-ViewPagerIndicator

Android ViewPagerIndicator Tabs

I got stuck with Jake Wharton ViewPagerIndicator.
The problem is that when I try to make a Tab indicator - the result I'm getting is extremely different from what I need and I can't get to style it or make it behave as it should.
So, what I ask for is two things:
1) Am I right when I say that TabIndicator is Foursquare-like ViewPagerIndicator? (when all tabs are shown on screen)
2) Can anyone provide me links to some tutorials or samples of using this type of ViewPagerIndicator, cause samples from JWs' site don't want to get working.
Thanks a lot for your attention!
Jake Wharton provides a lot of examples. Have you checked it?
https://github.com/JakeWharton/Android-ViewPagerIndicator
And you can take a preview installing this apk:
https://play.google.com/store/apps/details?id=com.viewpagerindicator.sample&hl=es
moskis is right on about ViewPagerIndicator. Installing that APK helped me a lot when I first started working with it and it is a great library.
However, to answer the first part of your question and what I think you are asking in general, I think ViewPagerIndicator isn't what you need to solve this specific problem. Foursquare's tabs at the top are the standard Android tabs as shown in http://developer.android.com/design/building-blocks/tabs.html.
Standard Android tabs are implemented using a TabHost and TabWidget. There is an official tutorial about creating a tabbed interface at http://developer.android.com/guide/topics/ui/layout/tabs.html
Foursquare achieves a custom look by providing state-list drawables for the tabs and you will probably want to provide your own to get the style that you want for your app.
Note that I don't have access to the Foursquare implementation, but am going off of what I observe whiel using the app. However, I have implemented a tabbed interface for Android in past projects.

Categories

Resources