1

Let me explain my question.

Simply I need Tab title/icon on FragmentTabHost for higher version.

If I check same for lower version they appear but disappears for higher version.

This is what I am using for now to get.

mTabHost = (FragmentTabHost)findViewById(android.R.id.tabhost); mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent); mTabHost.addTab(mTabHost.newTabSpec(TAB_1_TAG).setIndicator("Talk", getResources().getDrawable(R.drawable.ic_launcher)), TalkContainerFragment.class, null);

As per my knowledge there's problem in setIndicator(). It can take one item at a time i.e either title or icon at a time for higher version.

While searching I found some tutorial but they are utilizing deprecated methods which is not useful to me as I am performing same using Fragments.

Any help or suggestion will be highly appreciated. Thanks.

Abhishek Patel
  • 4,280
  • 1
  • 24
  • 38
AndroidHacker
  • 3,596
  • 1
  • 25
  • 45
  • I am facing same issue. Did you found any solution? – A J Jan 12 '17 at 03:47
  • 1
    In higher versions of android, you can either set the icon or the title value. So as a work around you may make use of set of icons with title included in it. For more on creating the tabs with in fragments check this out - http://stackoverflow.com/questions/18120510/dynamically-changing-the-fragments-inside-a-fragment-tab-host/19859871#19859871 – AndroidHacker Jan 12 '17 at 03:52
  • Thanks a lot for s quick reply. Let me check. – A J Jan 12 '17 at 03:54

1 Answers1

-1

Try set android:targetSdkVersion="10" with suitable number.

android:targetSdkVersion: An integer designating the API Level that the application targets. If not set, the default value equals that given to minSdkVersion. This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version. The application is still able to run on older versions (down to minSdkVersion).

As Android evolves with each new version, some behaviors and even appearances might change. However, if the API level of the platform is higher than the version declared by your app's targetSdkVersion, the system may enable compatibility behaviors to ensure that your app continues to work the way you expect. You can disable such compatibility behaviors by specifying targetSdkVersion to match the API level of the platform on which it's running. For example, setting this value to "11" or higher allows the system to apply a new default theme (Holo) to your app when running on Android 3.0 or higher and also disables screen compatibility mode when running on larger screens (because support for API level 11 implicitly supports larger screens).

There are many compatibility behaviors that the system may enable based on the value you set for this attribute. Several of these behaviors are described by the corresponding platform versions in the Build.VERSION_CODES reference.

To maintain your application along with each Android release, you should increase the value of this attribute to match the latest API level, then thoroughly test your application on the corresponding platform version.

LL520
  • 159
  • 3