本文整理汇总了Java中android.content.res.TypedArray.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java TypedArray.getValue方法的具体用法?Java TypedArray.getValue怎么用?Java TypedArray.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.res.TypedArray
的用法示例。
在下文中一共展示了TypedArray.getValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findSource
import android.content.res.TypedArray; //导入方法依赖的package包/类
private static InputSource findSource(final TypedArray textureViewAttributes) {
final TypedValue value = new TypedValue();
if (!textureViewAttributes.getValue(
R.styleable.GifTextureView_gifSource, value)) {
return null;
}
if (value.resourceId != 0) {
final String type = textureViewAttributes.getResources()
.getResourceTypeName(value.resourceId);
if ("drawable".equals(type) || "raw".equals(type)) {
return new InputSource.ResourcesSource(
textureViewAttributes.getResources(), value.resourceId);
} else if (!"string".equals(type)) {
throw new IllegalArgumentException(
"Expected string, drawable or raw resource, type "
+ type + " " + "cannot be converted to GIF");
}
}
return new InputSource.AssetSource(textureViewAttributes.getResources()
.getAssets(), value.string.toString());
}
示例2: applyFixedSizeWindow
import android.content.res.TypedArray; //导入方法依赖的package包/类
private void applyFixedSizeWindow() {
ContentFrameLayout cfl = (ContentFrameLayout) this.mSubDecor.findViewById(16908290);
View windowDecor = this.mWindow.getDecorView();
cfl.setDecorPadding(windowDecor.getPaddingLeft(), windowDecor.getPaddingTop(), windowDecor.getPaddingRight(), windowDecor.getPaddingBottom());
TypedArray a = this.mContext.obtainStyledAttributes(R.styleable.AppCompatTheme);
a.getValue(R.styleable.AppCompatTheme_windowMinWidthMajor, cfl.getMinWidthMajor());
a.getValue(R.styleable.AppCompatTheme_windowMinWidthMinor, cfl.getMinWidthMinor());
if (a.hasValue(R.styleable.AppCompatTheme_windowFixedWidthMajor)) {
a.getValue(R.styleable.AppCompatTheme_windowFixedWidthMajor, cfl.getFixedWidthMajor());
}
if (a.hasValue(R.styleable.AppCompatTheme_windowFixedWidthMinor)) {
a.getValue(R.styleable.AppCompatTheme_windowFixedWidthMinor, cfl.getFixedWidthMinor());
}
if (a.hasValue(R.styleable.AppCompatTheme_windowFixedHeightMajor)) {
a.getValue(R.styleable.AppCompatTheme_windowFixedHeightMajor, cfl.getFixedHeightMajor());
}
if (a.hasValue(R.styleable.AppCompatTheme_windowFixedHeightMinor)) {
a.getValue(R.styleable.AppCompatTheme_windowFixedHeightMinor, cfl.getFixedHeightMinor());
}
a.recycle();
cfl.requestLayout();
}