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


Java Resources.getDimensionPixelOffset方法代碼示例

本文整理匯總了Java中android.content.res.Resources.getDimensionPixelOffset方法的典型用法代碼示例。如果您正苦於以下問題:Java Resources.getDimensionPixelOffset方法的具體用法?Java Resources.getDimensionPixelOffset怎麽用?Java Resources.getDimensionPixelOffset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.content.res.Resources的用法示例。


在下文中一共展示了Resources.getDimensionPixelOffset方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initValues

import android.content.res.Resources; //導入方法依賴的package包/類
private void initValues(Context context, boolean editMode) {
  Resources res = context.getResources();
  mInterpolator = new AccelerateInterpolator();
  if (!editMode) {
    mSectionsCount = res.getInteger(R.integer.spb_default_sections_count);
    mSpeed = Float.parseFloat(res.getString(R.string.spb_default_speed));
    mReversed = res.getBoolean(R.bool.spb_default_reversed);
    mProgressiveStartActivated = res.getBoolean(R.bool.spb_default_progressiveStart_activated);
    mColors = new int[]{res.getColor(R.color.spb_default_color)};
    mStrokeSeparatorLength = res.getDimensionPixelSize(R.dimen.spb_default_stroke_separator_length);
    mStrokeWidth = res.getDimensionPixelOffset(R.dimen.spb_default_stroke_width);
  } else {
    mSectionsCount = 4;
    mSpeed = 1f;
    mReversed = false;
    mProgressiveStartActivated = false;
    mColors = new int[]{0xff33b5e5};
    mStrokeSeparatorLength = 4;
    mStrokeWidth = 4;
  }
  mProgressiveStartSpeed = mSpeed;
  mProgressiveStopSpeed = mSpeed;
  mGradients = false;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:25,代碼來源:SmoothProgressDrawable.java

示例2: SimpleMonthView

import android.content.res.Resources; //導入方法依賴的package包/類
public SimpleMonthView(Context context) {
	super(context);
	Resources resources = context.getResources();
	mDayLabelCalendar = Calendar.getInstance();
	mCalendar = Calendar.getInstance();

	mDayOfWeekTypeface = resources.getString(R.string.day_of_week_label_typeface);
	mMonthTitleTypeface = resources.getString(R.string.sans_serif);
	mDayTextColor = resources.getColor(R.color.date_picker_text_normal);
	mTodayNumberColor = resources.getColor(R.color.blue);
	mMonthTitleColor = resources.getColor(R.color.white);
	mMonthTitleBGColor = resources.getColor(R.color.circle_background);

	mStringBuilder = new StringBuilder(50);
	mFormatter = new Formatter(mStringBuilder, Locale.getDefault());

	MINI_DAY_NUMBER_TEXT_SIZE = resources.getDimensionPixelSize(R.dimen.day_number_size);
	MONTH_LABEL_TEXT_SIZE = resources.getDimensionPixelSize(R.dimen.month_label_size);
	MONTH_DAY_LABEL_TEXT_SIZE = resources.getDimensionPixelSize(R.dimen.month_day_label_text_size);
	MONTH_HEADER_SIZE = resources.getDimensionPixelOffset(R.dimen.month_list_item_header_height);
	DAY_SELECTED_CIRCLE_SIZE = resources.getDimensionPixelSize(R.dimen.day_number_select_circle_radius);

	mRowHeight = ((resources.getDimensionPixelOffset(R.dimen.date_picker_view_animator_height) - MONTH_HEADER_SIZE) / 6);

       initView();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:27,代碼來源:SimpleMonthView.java

示例3: YearPickerView

import android.content.res.Resources; //導入方法依賴的package包/類
public YearPickerView(Context context, DatePickerController controller) {
    super(context);
    mController = controller;
    mController.registerOnDateChangedListener(this);
    ViewGroup.LayoutParams frame = new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.WRAP_CONTENT);
    setLayoutParams(frame);
    Resources res = context.getResources();
    mViewSize = res.getDimensionPixelOffset(R.dimen.mdtp_date_picker_view_animator_height);
    mChildSize = res.getDimensionPixelOffset(R.dimen.mdtp_year_label_height);
    setVerticalFadingEdgeEnabled(true);
    setFadingEdgeLength(mChildSize / 3);
    init();
    setOnItemClickListener(this);
    setSelector(new StateListDrawable());
    setDividerHeight(0);
    onDateChanged();
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:19,代碼來源:YearPickerView.java

示例4: LayerTitleCache

import android.content.res.Resources; //導入方法依賴的package包/類
/**
 * Builds an instance of the LayerTitleCache.
 */
public LayerTitleCache(Context context) {
    mContext = context;
    Resources res = context.getResources();
    final int fadeWidthPx = res.getDimensionPixelOffset(R.dimen.border_texture_title_fade);
    final int faviconStartPaddingPx =
            res.getDimensionPixelSize(R.dimen.tab_title_favicon_start_padding);
    final int faviconEndPaddingPx =
            res.getDimensionPixelSize(R.dimen.tab_title_favicon_end_padding);
    mNativeLayerTitleCache = nativeInit(fadeWidthPx, faviconStartPaddingPx, faviconEndPaddingPx,
            R.drawable.spinner, R.drawable.spinner_white);
    mFaviconSize = res.getDimensionPixelSize(R.dimen.compositor_tab_title_favicon_size);
    mStandardTitleBitmapFactory =
            new TitleBitmapFactory(context, false, R.drawable.default_favicon);
    mDarkTitleBitmapFactory =
            new TitleBitmapFactory(context, true, R.drawable.default_favicon_white);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:20,代碼來源:LayerTitleCache.java

示例5: YearPickerView

import android.content.res.Resources; //導入方法依賴的package包/類
public YearPickerView(Context context, DatePickerController controller) {
    super(context);
    this.mController = controller;
    this.mController.registerOnDateChangedListener(this);
    setLayoutParams(new LayoutParams(-1, -2));
    Resources res = context.getResources();
    this.mViewSize = res.getDimensionPixelOffset(R.dimen.mdtp_date_picker_view_animator_height);
    this.mChildSize = res.getDimensionPixelOffset(R.dimen.mdtp_year_label_height);
    setVerticalFadingEdgeEnabled(true);
    setFadingEdgeLength(this.mChildSize / 3);
    init(context);
    setOnItemClickListener(this);
    setSelector(new StateListDrawable());
    setDividerHeight(0);
    onDateChanged();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:17,代碼來源:YearPickerView.java

示例6: handleAttr

import android.content.res.Resources; //導入方法依賴的package包/類
private void handleAttr(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes){
    final LayoutParams frame = new LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    setLayoutParams(frame);

    final Resources res = context.getResources();
    mViewSize = res.getDimensionPixelOffset(R.dimen.datepicker_view_animator_height);
    mChildSize = res.getDimensionPixelOffset(R.dimen.datepicker_year_label_height);

    setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            final int year = mAdapter.getYearForPosition(position);
            mAdapter.setSelection(year);

            if (mOnYearSelectedListener != null) {
                mOnYearSelectedListener.onYearChanged(YearPickerView.this, year);
            }
        }
    });

    mAdapter = new YearAdapter(getContext());
    setAdapter(mAdapter);
}
 
開發者ID:Gericop,項目名稱:DateTimePicker,代碼行數:25,代碼來源:YearPickerView.java

示例7: MyScheduleAdapter

import android.content.res.Resources; //導入方法依賴的package包/類
public MyScheduleAdapter(Context context, LUtils lUtils) {
    mContext = context;
    mLUtils = lUtils;
    Resources resources = context.getResources();
    mHourColorDefault = resources.getColor(R.color.my_schedule_hour_header_default);
    mHourColorPast = resources.getColor(R.color.my_schedule_hour_header_finished);
    mTitleColorDefault = resources.getColor(R.color.my_schedule_session_title_default);
    mTitleColorPast = resources.getColor(R.color.my_schedule_session_title_finished);
    mIconColorDefault = resources.getColor(R.color.my_schedule_icon_default);
    mIconColorPast = resources.getColor(R.color.my_schedule_icon_finished);
    mColorConflict = resources.getColor(R.color.my_schedule_conflict);
    mColorBackgroundDefault = resources.getColor(android.R.color.white);
    mColorBackgroundPast = resources.getColor(R.color.my_schedule_past_background);
    mListSpacing = resources.getDimensionPixelOffset(R.dimen.element_spacing_normal);
    TypedArray a = context.obtainStyledAttributes(new int[]{R.attr.selectableItemBackground});
    mSelectableItemBackground = a.getResourceId(0, 0);
    a.recycle();
    mIsRtl = UIUtils.isRtl(context);
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:20,代碼來源:MyScheduleAdapter.java

示例8: TextViewWithCircularIndicator

import android.content.res.Resources; //導入方法依賴的package包/類
public TextViewWithCircularIndicator(Context context, AttributeSet attributeSet) {
	super(context, attributeSet);
       
	Resources res = context.getResources();
	mCircleColor = res.getColor(R.color.blue);
	mRadius = res.getDimensionPixelOffset(R.dimen.month_select_circle_radius);
	mItemIsSelectedText = context.getResources().getString(R.string.item_is_selected);
       
	init();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:11,代碼來源:TextViewWithCircularIndicator.java

示例9: LatinKeyboard

import android.content.res.Resources; //導入方法依賴的package包/類
public LatinKeyboard(Context context, int xmlLayoutResId, int mode) {
    super(context, xmlLayoutResId, mode);
    final Resources res = context.getResources();
    mContext = context;
    mMode = mode;
    mRes = res;
    mShiftLockIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked);
    mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked);
    setDefaultBounds(mShiftLockPreviewIcon);
    mSpaceIcon = res.getDrawable(R.drawable.sym_keyboard_space);
    mSpaceAutoCompletionIndicator = res.getDrawable(R.drawable.sym_keyboard_space_led);
    mSpacePreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_space);
    mMicIcon = res.getDrawable(R.drawable.sym_keyboard_mic);
    mMicPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_mic);
    setDefaultBounds(mMicPreviewIcon);
    mButtonArrowLeftIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_left);
    mButtonArrowRightIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_right);
    m123MicIcon = res.getDrawable(R.drawable.sym_keyboard_123_mic);
    m123MicPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_123_mic);
    mHintIcon = res.getDrawable(R.drawable.hint_popup);
    setDefaultBounds(m123MicPreviewIcon);
    sSpacebarVerticalCorrection = res.getDimensionPixelOffset(
            R.dimen.spacebar_vertical_correction);
    mIsAlphaKeyboard = xmlLayoutResId == R.xml.kbd_qwerty
            || xmlLayoutResId == R.xml.kbd_qwerty_black;
    // The index of space key is available only after Keyboard constructor has finished.
    mSpaceKeyIndexArray = new int[] { indexOf(KP2AKeyboard.KEYCODE_SPACE) };
    initializeNumberHintResources(context);
    // TODO remove this initialization after cleanup
    mVerticalGap = super.getVerticalGap();
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:32,代碼來源:LatinKeyboard.java

示例10: TextViewWithCircularIndicator

import android.content.res.Resources; //導入方法依賴的package包/類
public TextViewWithCircularIndicator(Context context, AttributeSet attrs) {
    super(context, attrs);
    Resources res = context.getResources();
    this.mCircleColor = res.getColor(R.color.mdtp_accent_color);
    this.mRadius = res.getDimensionPixelOffset(R.dimen.mdtp_month_select_circle_radius);
    this.mItemIsSelectedText = context.getResources().getString(R.string.mdtp_item_is_selected);
    init();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:9,代碼來源:TextViewWithCircularIndicator.java

示例11: resetDimensionConstants

import android.content.res.Resources; //導入方法依賴的package包/類
/**
 * Helper function that gather the static constants from values/dimens.xml.
 * @param context The Android Context.
 */
public static void resetDimensionConstants(Context context) {
    Resources res = context.getResources();
    final float pxToDp = 1.0f / res.getDisplayMetrics().density;
    sStackedTabVisibleSize =
            res.getDimensionPixelOffset(R.dimen.stacked_tab_visible_size) * pxToDp;
    sStackBufferWidth = res.getDimensionPixelOffset(R.dimen.stack_buffer_width) * pxToDp;
    sStackBufferHeight = res.getDimensionPixelOffset(R.dimen.stack_buffer_height) * pxToDp;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:13,代碼來源:StackTab.java

示例12: onCreate

import android.content.res.Resources; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Load heights
    final Resources resources = getResources();
    mHeightTitleOnly = resources
            .getDimensionPixelOffset(R.dimen.map_slideableinfo_height_titleonly);
    mHeightMoscone = resources
            .getDimensionPixelOffset(R.dimen.map_slideableinfo_height_moscone);
    mHeightSession = resources
            .getDimensionPixelOffset(R.dimen.map_slideableinfo_height_session);
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:13,代碼來源:SlideableInfoFragment.java

示例13: SuggestionStripLayoutHelper

import android.content.res.Resources; //導入方法依賴的package包/類
public SuggestionStripLayoutHelper(final Context context, final AttributeSet attrs,
        final int defStyle, final ArrayList<TextView> wordViews,
        final ArrayList<View> dividerViews, final ArrayList<TextView> debugInfoViews) {
    mWordViews = wordViews;
    mDividerViews = dividerViews;
    mDebugInfoViews = debugInfoViews;

    final TextView wordView = wordViews.get(0);
    final View dividerView = dividerViews.get(0);
    mPadding = wordView.getCompoundPaddingLeft() + wordView.getCompoundPaddingRight();
    dividerView.measure(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    mDividerWidth = dividerView.getMeasuredWidth();

    final Resources res = wordView.getResources();
    mSuggestionsStripHeight = res.getDimensionPixelSize(
            R.dimen.config_suggestions_strip_height);

    final TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.SuggestionStripView, defStyle, R.style.SuggestionStripView);
    mSuggestionStripOptions = a.getInt(
            R.styleable.SuggestionStripView_suggestionStripOptions, 0);
    mAlphaObsoleted = ResourceUtils.getFraction(a,
            R.styleable.SuggestionStripView_alphaObsoleted, 1.0f);
    mColorValidTypedWord = a.getColor(R.styleable.SuggestionStripView_colorValidTypedWord, 0);
    mColorTypedWord = a.getColor(R.styleable.SuggestionStripView_colorTypedWord, 0);
    mColorAutoCorrect = a.getColor(R.styleable.SuggestionStripView_colorAutoCorrect, 0);
    mColorSuggested = a.getColor(R.styleable.SuggestionStripView_colorSuggested, 0);
    mSuggestionsCountInStrip = a.getInt(
            R.styleable.SuggestionStripView_suggestionsCountInStrip,
            DEFAULT_SUGGESTIONS_COUNT_IN_STRIP);
    mCenterSuggestionWeight = ResourceUtils.getFraction(a,
            R.styleable.SuggestionStripView_centerSuggestionPercentile,
            DEFAULT_CENTER_SUGGESTION_PERCENTILE);
    mMaxMoreSuggestionsRow = a.getInt(
            R.styleable.SuggestionStripView_maxMoreSuggestionsRow,
            DEFAULT_MAX_MORE_SUGGESTIONS_ROW);
    mMinMoreSuggestionsWidth = ResourceUtils.getFraction(a,
            R.styleable.SuggestionStripView_minMoreSuggestionsWidth, 1.0f);
    a.recycle();

    mMoreSuggestionsHint = getMoreSuggestionsHint(res,
            res.getDimension(R.dimen.config_more_suggestions_hint_text_size),
            mColorAutoCorrect);
    mCenterPositionInStrip = mSuggestionsCountInStrip / 2;
    // Assuming there are at least three suggestions. Also, note that the suggestions are
    // laid out according to script direction, so this is left of the center for LTR scripts
    // and right of the center for RTL scripts.
    mTypedWordPositionWhenAutocorrect = mCenterPositionInStrip - 1;
    mMoreSuggestionsBottomGap = res.getDimensionPixelOffset(
            R.dimen.config_more_suggestions_bottom_gap);
    mMoreSuggestionsRowHeight = res.getDimensionPixelSize(
            R.dimen.config_more_suggestions_row_height);
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:55,代碼來源:SuggestionStripLayoutHelper.java

示例14: getNavigationBarrH

import android.content.res.Resources; //導入方法依賴的package包/類
public static int getNavigationBarrH(Context c) {
    Resources resources = c.getResources();
    int identifier = resources.getIdentifier("navigation_bar_height", "dimen", "android");
    return resources.getDimensionPixelOffset(identifier);
}
 
開發者ID:ceji-longquan,項目名稱:ceji_android,代碼行數:6,代碼來源:DensityUtil.java

示例15: MonthView

import android.content.res.Resources; //導入方法依賴的package包/類
public MonthView(Context context, AttributeSet attr, DatePickerController controller) {
    super(context, attr);
    mController = controller;
    Resources res = context.getResources();

    mDayLabelCalendar = Calendar.getInstance(mController.getTimeZone());
    mCalendar = Calendar.getInstance(mController.getTimeZone());

    mDayOfWeekTypeface = res.getString(R.string.mdtp_day_of_week_label_typeface);
    mMonthTitleTypeface = res.getString(R.string.mdtp_sans_serif);

    boolean darkTheme = mController != null && mController.isThemeDark();
    if(darkTheme) {
        mDayTextColor = getResources().getColor(R.color.mdtp_date_picker_text_normal_dark_theme);
        mMonthDayTextColor = getResources().getColor(R.color.mdtp_date_picker_month_day_dark_theme);
        mDisabledDayTextColor = getResources().getColor( R.color.mdtp_date_picker_text_disabled_dark_theme);
        mHighlightedDayTextColor = getResources().getColor(R.color.mdtp_date_picker_text_highlighted_dark_theme);
    }
    else {
        mDayTextColor = getResources().getColor(R.color.mdtp_date_picker_text_normal);
        mMonthDayTextColor = getResources().getColor(R.color.mdtp_date_picker_month_day);
        mDisabledDayTextColor = getResources().getColor(R.color.mdtp_date_picker_text_disabled);
        mHighlightedDayTextColor = getResources().getColor(R.color.mdtp_date_picker_text_highlighted);
    }
    mSelectedDayTextColor = getResources().getColor(R.color.mdtp_white);
    mTodayNumberColor = mController.getAccentColor();
    mMonthTitleColor = getResources().getColor(R.color.mdtp_white);

    mStringBuilder = new StringBuilder(50);
    mFormatter = new Formatter(mStringBuilder, Locale.getDefault());

    MINI_DAY_NUMBER_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_day_number_size);
    MONTH_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_month_label_size);
    MONTH_DAY_LABEL_TEXT_SIZE = res.getDimensionPixelSize(R.dimen.mdtp_month_day_label_text_size);
    MONTH_HEADER_SIZE = res.getDimensionPixelOffset(R.dimen.mdtp_month_list_item_header_height);
    DAY_SELECTED_CIRCLE_SIZE = res
            .getDimensionPixelSize(R.dimen.mdtp_day_number_select_circle_radius);

    mRowHeight = (res.getDimensionPixelOffset(R.dimen.mdtp_date_picker_view_animator_height)
            - getMonthHeaderSize()) / MAX_NUM_ROWS;

    // Set up accessibility components.
    mTouchHelper = getMonthViewTouchHelper();
    ViewCompat.setAccessibilityDelegate(this, mTouchHelper);
    ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    mLockAccessibilityDelegate = true;

    // Sets up any standard paints that will be used
    initView();
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:51,代碼來源:MonthView.java


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