本文整理汇总了Java中android.support.v7.internal.view.ContextThemeWrapper类的典型用法代码示例。如果您正苦于以下问题:Java ContextThemeWrapper类的具体用法?Java ContextThemeWrapper怎么用?Java ContextThemeWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContextThemeWrapper类属于android.support.v7.internal.view包,在下文中一共展示了ContextThemeWrapper类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setDropDownViewTheme
import android.support.v7.internal.view.ContextThemeWrapper; //导入依赖的package包/类
public void setDropDownViewTheme(android.content.res.Resources.Theme theme)
{
if (theme == null)
{
mDropDownInflater = null;
return;
}
if (theme == mContext.getTheme())
{
mDropDownInflater = mInflater;
return;
} else
{
mDropDownInflater = LayoutInflater.from(new ContextThemeWrapper(mContext, theme));
return;
}
}
开发者ID:Hamz-a,项目名称:MyCTFWriteUps,代码行数:18,代码来源:ThemedSpinnerAdapter.java
示例2: getAppCompActivity
import android.support.v7.internal.view.ContextThemeWrapper; //导入依赖的package包/类
/**
* Get AppCompatActivity from context
*
* @param context
* @return AppCompatActivity if it's not null
*/
public static AppCompatActivity getAppCompActivity(Context context) {
if (context == null) return null;
if (context instanceof AppCompatActivity) {
return (AppCompatActivity) context;
} else if (context instanceof ContextThemeWrapper) {
return getAppCompActivity(((ContextThemeWrapper) context).getBaseContext());
}
return null;
}
开发者ID:CarGuo,项目名称:GSYVideoPlayer,代码行数:16,代码来源:CommonUtil.java
示例3: createDialog
import android.support.v7.internal.view.ContextThemeWrapper; //导入依赖的package包/类
public static AlertDialog createDialog(Activity activity, int type) {
ContextThemeWrapper wrapper = new ContextThemeWrapper(activity, android.R.style.Theme_Holo);
AlertDialog.Builder builder = new AlertDialog.Builder(wrapper);
LayoutInflater inflater = activity.getLayoutInflater();
switch (type) {
case LOADING_DIALOG:
builder.setView(inflater.inflate(R.layout.loading_dialog, null));
break;
case BACKUP_DIALOG:
builder.setView(inflater.inflate(R.layout.backup_dialog, null));
break;
case SAVING_DIALOG:
builder.setView(inflater.inflate(R.layout.saving_dialog, null));
break;
case INFO_DIALOG:
final SharedPreferences sharedPreferences = activity.getSharedPreferences(FragmentActivity.PREFERENCES_NAME, FragmentActivity.MODE_PRIVATE);
View view = View.inflate(activity, R.layout.info_dialog_view, null);
final CheckBox infoDialogCheckBox = (CheckBox) view.findViewById(R.id.infoDialogCheckBox);
builder
.setMessage(R.string.dialog_info_message)
.setView(view)
// .setView(view,16,16,16,16)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (infoDialogCheckBox.isChecked()) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(FragmentActivity.INFO_DIALOG_KEY, true);
editor.apply();
}
dialog.dismiss();
}
});
break;
}
return builder.create();
}
开发者ID:khasang,项目名称:FixMyNumber,代码行数:38,代码来源:DialogCreator.java
注:本文中的android.support.v7.internal.view.ContextThemeWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论