用AppCompat替换ActionBarSherlock [英] Replacing ActionBarSherlock With AppCompat

本文介绍了用AppCompat替换ActionBarSherlock的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用一个简单的导航抽屉和滑动选项卡。

I'm currently working on a simple navigation drawer + sliding tab.

但是,我希望在我自己的应用程序中使用这些材料进行设计。

However, I wanted these a material design on my own app.

因此,我别无选择,只能摆脱 ActionBarSherlock 。在进行这些尝试时,我发现了两种导入类型,如下所示:

Therefore, I have no choice except to get rid off ActionBarSherlock. When in these attempt, I found that 2 types of imports which are as follows:

import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.app.SherlockFragmentActivity;

也必须删除。但是,删除它后,似乎还会出现更多错误。

has to be removed too. However, more errors seem to appear after removing it.

那么,有没有其他类型的进口商品可以代替上面的这两个?

So, is there any other type of imports that could replace these 2 above?

推荐答案

如果您要使用 appcompat-v7 ,我确定您有 support-v4 在您的依赖项中也是如此。

If you're going to use appcompat-v7, I am sure you have support-v4 in your dependencies as well.

您可以尝试替换


  • com.actionbarsherlock .app.SherlockFragment android.support.v4.app.Fragment

  • com.actionbarsherlock.app.SherlockFragmentActivity
    android.support.v7.app.AppCompatActivity

  • com.actionbarsherlock.app.SherlockFragment with android.support.v4.app.Fragment
  • com.actionbarsherlock.app.SherlockFragmentActivity with android.support.v7.app.AppCompatActivity

从ABS迁移到AppCompat有一些好的建议。

There are some good advices on migrating from ABS to AppCompat.

ActionBarCompat(第3部分):从ActionBarSherlock迁移

上面的示例要注意的是 ActionBarActivity 现在已弃用,并替换为 AppCompatActivity

Something to note with above examples is that ActionBarActivity is now deprecated and replaced by AppCompatActivity.

这篇关于用AppCompat替换ActionBarSherlock的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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