本文整理了Java中android.content.res.Configuration.setTo()
方法的一些代码示例,展示了Configuration.setTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.setTo()
方法的具体详情如下:
包路径:android.content.res.Configuration
类名称:Configuration
方法名:setTo
暂无
代码示例来源:origin: facebook/litho
private LithoView setupLithoViewForDoubleMeasureTest(
int screenWidthDp, float density, int screenWidthPx) {
final Context context = spy(new ContextWrapper(RuntimeEnvironment.application));
final Resources resources = spy(context.getResources());
doReturn(resources).when(context).getResources();
final Configuration configuration = new Configuration();
configuration.setTo(resources.getConfiguration());
final DisplayMetrics displayMetrics = new DisplayMetrics();
displayMetrics.setTo(resources.getDisplayMetrics());
doReturn(configuration).when(resources).getConfiguration();
doReturn(displayMetrics).when(resources).getDisplayMetrics();
configuration.screenWidthDp = screenWidthDp;
displayMetrics.density = density;
displayMetrics.widthPixels = screenWidthPx;
return new LithoView(context);
}
代码示例来源:origin: robolectric/robolectric
final Configuration currentConfig = component.getResources().getConfiguration();
final int changedBits = currentConfig.diff(newConfiguration);
currentConfig.setTo(newConfiguration);
代码示例来源:origin: org.robolectric/shadows-core-v23
public void __constructor__(Configuration other) {
realConfiguration.setTo(other);
}
代码示例来源:origin: org.robolectric/shadows-core
@Deprecated
@Implementation
public void setTo(Configuration o) {
directlyOn(realConfiguration, Configuration.class).setTo(o);
}
代码示例来源:origin: baidu/GPT
/**
* createTargetResource
*/
private void createTargetResource() {
try {
AssetManager am = (AssetManager) AssetManager.class.newInstance();
JavaCalls.callMethod(am, "addAssetPath", new Object[]{apkFile.getAbsolutePath()});
targetAssetManager = am;
} catch (Exception e) {
if (DEBUG) {
e.printStackTrace();
}
}
// 解决一个HTC ONE X上横竖屏会黑屏的问题
Resources hostRes = mHostAppContext.getResources();
Configuration config = new Configuration();
config.setTo(hostRes.getConfiguration());
config.orientation = Configuration.ORIENTATION_UNDEFINED;
targetResources = new ResourcesProxy(targetAssetManager, hostRes.getDisplayMetrics(), config, hostRes);
targetTheme = targetResources.newTheme();
targetTheme.setTo(mHostAppContext.getTheme());
targetTheme.applyStyle(targetMapping.getTheme(), true);
}
代码示例来源:origin: org.robolectric/shadows-framework
final Configuration currentConfig = component.getResources().getConfiguration();
final int changedBits = currentConfig.diff(newConfiguration);
currentConfig.setTo(newConfiguration);
代码示例来源:origin: iqiyi/Neptune
config.setTo(mHostResource.getConfiguration());
if (mPluginPackageInfo.isIndividualMode()) {
内容来源于网络,如有侵权,请联系作者删除!