本文整理匯總了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();
}