當前位置: 首頁>>代碼示例>>Java>>正文


Java TypedValue.getDimension方法代碼示例

本文整理匯總了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;
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:24,代碼來源:AbsHListView.java

示例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;
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:17,代碼來源:RecyclerView.java

示例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;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:12,代碼來源:AbsHListView.java

示例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;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:11,代碼來源:RecyclerView.java

示例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;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:13,代碼來源:NestedScrollView.java


注:本文中的android.util.TypedValue.getDimension方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。