我有一个AppCompatPreferenceActivity.java.但这显示了一个错误
公共类SettingsActivity扩展了AppCompatPreferenceActivity
它说它无法解析’AppCompatPreferenceActivity’.
看来我是唯一遇到此问题的人.任何想法?
错误:(21、39)错误:找不到符号类AppCompatPreferenceActivity
解决方法:
Google支持库中不存在AppCompatPreferenceActivity,
您应该使用相同的名称创建一个类并使用此源:
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {private AppCompatDelegate mDelegate;@OverrIDeprotected voID onCreate(Bundle savedInstanceState) { getDelegate().installVIEwFactory(); getDelegate().onCreate(savedInstanceState); super.onCreate(savedInstanceState);}@OverrIDeprotected voID onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); getDelegate().onPostCreate(savedInstanceState);}public Actionbar getSupportActionbar() { return getDelegate().getSupportActionbar();}public voID setSupportActionbar(@Nullable Toolbar toolbar) { getDelegate().setSupportActionbar(toolbar);}@OverrIDepublic MenuInflater getMenuInflater() { return getDelegate().getMenuInflater();}@OverrIDepublic voID setContentVIEw(@LayoutRes int layoutResID) { getDelegate().setContentVIEw(layoutResID);}@OverrIDepublic voID setContentVIEw(VIEw vIEw) { getDelegate().setContentVIEw(vIEw);}@OverrIDepublic voID setContentVIEw(VIEw vIEw, VIEwGroup.LayoutParams params) { getDelegate().setContentVIEw(vIEw, params);}@OverrIDepublic voID addContentVIEw(VIEw vIEw, VIEwGroup.LayoutParams params) { getDelegate().addContentVIEw(vIEw, params);}@OverrIDeprotected voID onPostResume() { super.onPostResume(); getDelegate().onPostResume();}@OverrIDeprotected voID onTitleChanged(CharSequence Title, int color) { super.onTitleChanged(Title, color); getDelegate().setTitle(Title);}@OverrIDepublic voID onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); getDelegate().onConfigurationChanged(newConfig);}@OverrIDeprotected voID onStop() { super.onStop(); getDelegate().onStop();}@OverrIDeprotected voID onDestroy() { super.onDestroy(); getDelegate().onDestroy();}public voID invalIDateOptionsMenu() { getDelegate().invalIDateOptionsMenu();}private AppCompatDelegate getDelegate() { if (mDelegate == null) { mDelegate = AppCompatDelegate.create(this, null); } return mDelegate;}}
总结 以上是内存溢出为你收集整理的java-无法在SettingsActivity中解析“ AppCompatPreferenceActivity”全部内容,希望文章能够帮你解决java-无法在SettingsActivity中解析“ AppCompatPreferenceActivity”所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)