在Android Froyo的底部操作栏(API 8) [英] Bottom action bar on android froyo (api 8)

查看:133
本文介绍了在Android Froyo的底部操作栏(API 8)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人找到一种方式来获得的Andr​​oid版本底部操作栏年纪比4(API 14)?我读教程,它说我需要API 14。但我知道人们身边有类似的界限经常发现的方式。我AP preciate任何线索。

Has anyone found a way to get a bottom action bar on android versions older than 4 (api 14)? I am reading the tutorial and it says I need api 14. But I know folks have often found ways around similar boundaries. I appreciate any leads.

推荐答案

你可以做到这一点与< 14 API期运用 actionbarsherlock 只是补充说,库中的项目。

you can do this in < 14 API useing actionbarsherlock just add that library in your Project.

在这里看到我有code像

see here i have code like

public class MainActivity extends SherlockActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        setTheme(R.style.Theme_Sherlock_Light);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        menu.add("Save").setIcon(R.drawable.ic_launcher)
                .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
        menu.add("Search").setShowAsAction(
                MenuItem.SHOW_AS_ACTION_ALWAYS
                        | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
        SubMenu sub = menu.addSubMenu("Options");
        sub.add(0, SubMenu.NONE, 0, "First");
        sub.add(0, SubMenu.NONE, 1, "Second");
        sub.add(0, SubMenu.NONE, 2, "Three");
        sub.getItem().setShowAsAction(
                MenuItem.SHOW_AS_ACTION_ALWAYS
                        | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
        // HERE IS WHere I AM FACING PROBLEM IN
        getSupportMenuInflater().inflate(R.menu.activity_main, menu);
        MenuItem actionItem = menu
                .findItem(R.id.menu_item_share_action_provider_action_bar);
        ShareActionProvider actionProvider = (ShareActionProvider) actionItem
                .getActionProvider();
        actionProvider
                .setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // this
                                                                                                // is
                                                                                                // BRILLIANT
                                                                                                // WAY
                                                                                                // TO
                                                                                                // AVOID
                                                                                                // REPEATation
        actionProvider.setShareIntent(createShareIntent());

        return super.onCreateOptionsMenu(menu);
    }

    private Intent createShareIntent() {

        Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");

        sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "hi hello");

        return sharingIntent;
    }
}

这是在Android清单我必须添加安卓uiOptions =splitActionBarWhenNarrow

an in android manifest i have add android:uiOptions="splitActionBarWhenNarrow"

<application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"
        android:uiOptions="splitActionBarWhenNarrow" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>


所以O / P是(Galaxy Tab的安卓2.3.3)


so o/p is in (Galaxy Tab Android 2.3.3)

这篇关于在Android Froyo的底部操作栏(API 8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆