Replacing ActionBarSherlock With AppCompat

大城市里の小女人 提交于 2019-12-21 05:47:06

问题


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

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

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?


回答1:


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

You can try replacing

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

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

  • What are the common issues when migrating from ActionBarSherlock to ActionBarCompat?

  • ActionBarCompat (Part 3): Migrating from ActionBarSherlock

  • Migrating from ActionBarSherlock to ActionBarCompat

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



来源:https://stackoverflow.com/questions/31197706/replacing-actionbarsherlock-with-appcompat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!