本文整理匯總了Java中android.util.TypedValue.getDimension方法的典型用法代碼示例。如果您正苦於以下問題:Java TypedValue.getDimension方法的具體用法?Java TypedValue.getDimension怎麽用?Java TypedValue.getDimension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.util.TypedValue
的用法示例。
在下文中一共展示了TypedValue.getDimension方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getHorizontalScrollFactor
import android.util.TypedValue; //導入方法依賴的package包/類
/**
* Gets a scale factor that determines the distance the view should scroll
* vertically in response to {@link MotionEvent#ACTION_SCROLL}.
*
* @return The vertical scroll scale factor.
*/
protected float getHorizontalScrollFactor() {
if (mHorizontalScrollFactor == 0) {
TypedValue outValue = new TypedValue();
boolean success = getContext().getTheme().resolveAttribute(
R.attr.hlv_listPreferredItemWidth, outValue, true);
if (success) {
mHorizontalScrollFactor = outValue.getDimension(getContext()
.getResources().getDisplayMetrics());
} else {
throw new IllegalStateException(
"Expected theme to define hlv_listPreferredItemWidth.");
}
}
return mHorizontalScrollFactor;
}
示例2: getScrollFactor
import android.util.TypedValue; //導入方法依賴的package包/類
/**
* Ported from View.getVerticalScrollFactor.
*/
private float getScrollFactor() {
if (mScrollFactor == Float.MIN_VALUE) {
TypedValue outValue = new TypedValue();
if (getContext().getTheme().resolveAttribute(
android.R.attr.listPreferredItemHeight, outValue, true)) {
mScrollFactor = outValue.getDimension(
getContext().getResources().getDisplayMetrics());
} else {
return 0; //listPreferredItemHeight is not defined, no generic scrolling
}
}
return mScrollFactor;
}
示例3: getHorizontalScrollFactor
import android.util.TypedValue; //導入方法依賴的package包/類
protected float getHorizontalScrollFactor() {
if (this.mHorizontalScrollFactor == 0.0f) {
TypedValue outValue = new TypedValue();
if (getContext().getTheme().resolveAttribute(2130771970, outValue, true)) {
this.mHorizontalScrollFactor = outValue.getDimension(getContext().getResources().getDisplayMetrics());
} else {
throw new IllegalStateException("Expected theme to define hlv_listPreferredItemWidth.");
}
}
return this.mHorizontalScrollFactor;
}
示例4: getScrollFactor
import android.util.TypedValue; //導入方法依賴的package包/類
private float getScrollFactor() {
if (this.mScrollFactor == Float.MIN_VALUE) {
TypedValue outValue = new TypedValue();
if (!getContext().getTheme().resolveAttribute(16842829, outValue, true)) {
return 0.0f;
}
this.mScrollFactor = outValue.getDimension(getContext().getResources().getDisplayMetrics());
}
return this.mScrollFactor;
}
示例5: getVerticalScrollFactorCompat
import android.util.TypedValue; //導入方法依賴的package包/類
private float getVerticalScrollFactorCompat() {
if (this.mVerticalScrollFactor == 0.0f) {
TypedValue outValue = new TypedValue();
Context context = getContext();
if (context.getTheme().resolveAttribute(16842829, outValue, true)) {
this.mVerticalScrollFactor = outValue.getDimension(context.getResources().getDisplayMetrics());
} else {
throw new IllegalStateException("Expected theme to define listPreferredItemHeight.");
}
}
return this.mVerticalScrollFactor;
}