android.content.res.Configuration.setTo()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中android.content.res.Configuration.setTo()方法的一些代码示例,展示了Configuration.setTo()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.setTo()方法的具体详情如下:
包路径:android.content.res.Configuration
类名称:Configuration
方法名:setTo

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()) {

相关文章