Can i use Fragments in 2.2 version of the Android (Froyo) using the compatibility package ?
I want to use two nested Tabs which on clicking should display related content in the Fragments.
Have a look at ActionbarSherlock. Short description from their website:
ActionBarSherlock is an extension of the compatibility library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API.
With one API you can use all that 3.0 stuff on pre-3.0 devices. (It looks the same and behaves the same)
Yes you can. Tabs are not supported in the ActionBar by the compatibility library.
Related
I am creating a new application and will have to deal with ActionBar. I know that I have to extend the AppCompatActivity because the ActionBarActivity is deprecated, however I still do not understand why I have to use the support.v7.widget Toolbar rather than the android.widget Toolbar even though I am using the latest API ?
Thank you
EDIT1:
I understand now that the support.v7.widgets are there to enable devices with old APIs to comprehend what are the new functionalities added in the newer versions and mimic them in their own way. Is that correct ?
If that is correct and I do not want to have any sort of backwards compatibility does this mean I can move forward and use the android.widget Toolbar ?
Also using the android.widget Fragment unfortunately I can not add it to a ViewPager. Why is that ? Why does it force me to use an older version which has been extended to mimic the behaviour of the new implementation of the component ?
I think I just getting lost in all of those "support" libraries. Can someone briefly ( or not ) explain all that - why are there things in the support libraries that are not included or updated in the newer versions of the API ?
Thank you
First of all you are asking Good Question, Android will add advanced features continuously in different API levels but those features are available from which level of API they are added
For Example: Consider android fragment functionality was added in API level 11 that means it will work for API level 11 and above but your application need for API level 10 devices also at that time it wont be work. For this reason android develop support library for cover a wide range of Android devices (support for low level API) to work those functionality.
Android always recommend developers to use support library for development for more information check here
Support.V7.widgets and widgets.android both are different libraries.
support.v7.widgets uses design library.
toolbar actually not an actionbar we are manually implementing a
ActionBar with support library.
And there are lot more new inbuilt properties are included like observableScrollActivity and More material designs...,
Why we aren't using default actionbar?
Because ActionBarActivity is depricated. Comparing old actionbar with our latest sdk actionbar it gives good look.
.setSupportActionBar(toolbar);
After Setting support to the toolbar gives actionbar properties to the toolbar like we can hide it by getSupportActionBar().hide();
I want to implement the android navigation drawer for my app that is supporting jellybean and higher. All tutorials I seen so far use the support version.
I am wondering, are they doing that to support people who want to support old android versions?
If possible I want to use the non-support version. Does anyone know where I can find a good tutorial for that?
Or is using the support version the only way to get it?
http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/
Thanks
The docs for the Support Library states:
The Android Support Library package is a set of code libraries that
provide backward-compatible versions of Android framework APIs as well
as features that are only available through the library APIs.
This means that this library contains components, which are not included in the Android SDK. F.e. the ViewPager and related classes like the family of PagerAdapters or even the DrawerLayout.
I'm planning an Android app that should make use of lots of UI features that later SDK versions bring with them incl. ActionBar, ActionBar.Tabs, Swipe navigation and use of Fragments (with replace, add, FragmentTransaction etc). The app should support SDK 8 (2.2) and later.
I'm a 'bit' at a loss here on how to set this up: will I be able to use all these features with the official Android compatibility library? Or will I have to use ActionBarSherlock? Will ABS give me advantages/ be easier to implement compared to the official comp. library?
Can I use the Eclipse/ ADT navigation templates with those two librarys? Can I use them alongside each other or do I have to comit to one of them?
Lot's of questions, I know :)
will I be able to use all these features with the official Android compatibility library?
No.
Or will I have to use ActionBarSherlock?
Yes.
Will ABS give me advantages/ be easier to implement compared to the official comp. library?
It will give you a backwards-compatible action bar. The Android Support Library does not.
Can I use the Eclipse/ ADT navigation templates with those two librarys?
You can do whatever you want. You will need to replace some stuff generated by those templates.
I think using using ActionBarSherlock is the best.
Have a look at this link
I am creating application which will support Android 2.2 to Android 4.1. The TabHost is deprecated in Android version 3.2. But the created application supported in all the versions. But I want to create the Tab bar application which will look like a tab bar in Android 4.1 while running the application in Android 4.2, If I am running the application in below android 3.2 version device, it must look like the tab bar in that device. How can I do this.?
There are many points to your question,
TabHost is not deprecated yet. Recently Google deprecated TabActivity and ActivityGroup.
Even if it deprecated, it doesn't mean it can't be used. If X is deprecated, it only means a better alternative named Y is there.
Now to answer your question, You have more than one options
You can use ActionBarSherlock as other answers suggests. (EDIT : ActionBarSherlock is now deprecated.)
You can use TabHost with fragments, See my answer here for a
good example. To use Fragment in pre 3.0 API's you need to use
Google's support library.
Try out ActionBarSherlock.
ActionBarSherlock is an extension of the support library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API.
The library will automatically use the native action bar when appropriate or will automatically wrap a custom implementation around your layouts. This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.
Tutorials:
tutorial 1 , tutorial 2 ,
tutorial 3
Just to add, Android has introduced ActionBarCompat to ensure ActionBar is compatible with OS below 3.0 down to 2.1. You can use ActionBarCompat in the support library instead of ActionBarSherlock
http://android-developers.blogspot.co.uk/2013/08/actionbarcompat-and-io-2013-app-source.html
I want to develop a new Android app. Design guidelines for Droid 3.0+ encourage the use of fragments to create a UI that better utilizes tablets' screen space. Also, from Droid 3.0+ I have read that a menu bar should exist on every activity that has a menu instead of using the plain old menu key
These features are supported by SDK 11+, but I want to support SDK 8 as minimum SDK in order to achieve best market share (see here).
How can I achieve both of my objectives?
You have two possibilities:
Google provide support library for developing apps with using fragments and action bars with support of old android versions.
There is great tool Action Bar Sherlock.