简体   繁体   中英

android minimum and target SDK

I have a very basic question.

I have a project which has minSDKVersion set to 8 and targetSDK version as 16 . Now one of the methods I used setActionView() using this link .

requires a min API level of 11 . I just want to know if it'll work in version 2.2 or not?? Or if there is a way to support previous devices?I want to use collapsible action item which requires the use of 'setActionView()'. Is there any other way to use this?

If it says this feature requires a minimum API level that is greater than what you set in your manifest, you will have trouble using this feature in these older devices. But check Android support library . This may help you support these devices.

if you are using MenuItem com.actionbarsherlock.view.MenuItem. setActionView (View view) then the support for the same should be there in library and will work on 2.2 .

您可能还想查看ActionBarCompat,为您提供此功能...(请参阅此链接

When using android appcompact actionbar library, you could use setActionView with SupportMenuItem.So your code should be like

private SupportMenuItem menuItem=(SupportMenuItem) menu.findItem(R.id.menu_refresh);
menuItem.setActionView(R.layout.progressbar);

您可以使用支持库来做到这一点: MenuItemCompat.setActionView(yourMenuItem, R.layout.your_view);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM