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


Java Resources.getDimensionPixelSize方法代碼示例

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


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

示例1: adjustDropDownSizeAndPosition

import android.content.res.Resources; //導入方法依賴的package包/類
private void adjustDropDownSizeAndPosition() {
    if (this.mDropDownAnchor.getWidth() > 1) {
        int offset;
        Resources res = getContext().getResources();
        int anchorPadding = this.mSearchPlate.getPaddingLeft();
        Rect dropDownPadding = new Rect();
        boolean isLayoutRtl = ViewUtils.isLayoutRtl(this);
        int iconOffset = this.mIconifiedByDefault ? res.getDimensionPixelSize(R.dimen.abc_dropdownitem_icon_width) + res.getDimensionPixelSize(R.dimen.abc_dropdownitem_text_padding_left) : 0;
        this.mSearchSrcTextView.getDropDownBackground().getPadding(dropDownPadding);
        if (isLayoutRtl) {
            offset = -dropDownPadding.left;
        } else {
            offset = anchorPadding - (dropDownPadding.left + iconOffset);
        }
        this.mSearchSrcTextView.setDropDownHorizontalOffset(offset);
        this.mSearchSrcTextView.setDropDownWidth((((this.mDropDownAnchor.getWidth() + dropDownPadding.left) + dropDownPadding.right) + iconOffset) - anchorPadding);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:19,代碼來源:SearchView.java

示例2: AllAppsBackgroundDrawable

import android.content.res.Resources; //導入方法依賴的package包/類
public AllAppsBackgroundDrawable(Context context) {
    Resources res = context.getResources();
    mHand = new TransformedImageDrawable(context, res, R.drawable.ic_all_apps_bg_hand,
            0.575f, 0.f, Gravity.CENTER_HORIZONTAL);
    mIcons = new TransformedImageDrawable[4];
    mIcons[0] = new TransformedImageDrawable(context, res, R.drawable.ic_all_apps_bg_icon_1,
            0.375f, 0, Gravity.CENTER_HORIZONTAL);
    mIcons[1] = new TransformedImageDrawable(context, res, R.drawable.ic_all_apps_bg_icon_2,
            0.3125f, 0.2f, Gravity.CENTER_HORIZONTAL);
    mIcons[2] = new TransformedImageDrawable(context, res, R.drawable.ic_all_apps_bg_icon_3,
            0.475f, 0.26f, Gravity.CENTER_HORIZONTAL);
    mIcons[3] = new TransformedImageDrawable(context, res, R.drawable.ic_all_apps_bg_icon_4,
            0.7f, 0.125f, Gravity.CENTER_HORIZONTAL);
    mWidth = res.getDimensionPixelSize(R.dimen.all_apps_background_canvas_width);
    mHeight = res.getDimensionPixelSize(R.dimen.all_apps_background_canvas_height);
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:17,代碼來源:AllAppsBackgroundDrawable.java

示例3: getUserBadge

import android.content.res.Resources; //導入方法依賴的package包/類
private synchronized Bitmap getUserBadge(UserHandle user, Context context) {
    Bitmap badgeBitmap = mUserBadges.get(user);
    if (badgeBitmap != null) {
        return badgeBitmap;
    }

    final Resources res = context.getApplicationContext().getResources();
    int badgeSize = res.getDimensionPixelSize(R.dimen.profile_badge_size);
    badgeBitmap = Bitmap.createBitmap(badgeSize, badgeSize, Bitmap.Config.ARGB_8888);

    Drawable drawable = context.getPackageManager().getUserBadgedDrawableForDensity(
            new BitmapDrawable(res, badgeBitmap), user, new Rect(0, 0, badgeSize, badgeSize),
            0);
    if (drawable instanceof BitmapDrawable) {
        badgeBitmap = ((BitmapDrawable) drawable).getBitmap();
    } else {
        badgeBitmap.eraseColor(Color.TRANSPARENT);
        Canvas c = new Canvas(badgeBitmap);
        drawable.setBounds(0, 0, badgeSize, badgeSize);
        drawable.draw(c);
        c.setBitmap(null);
    }

    mUserBadges.put(user, badgeBitmap);
    return badgeBitmap;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:27,代碼來源:DrawableFactory.java

示例4: init

import android.content.res.Resources; //導入方法依賴的package包/類
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    Resources r = context.getResources();

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MDRootLayout, defStyleAttr, 0);
    reducePaddingNoTitleNoButtons = a.getBoolean(R.styleable.MDRootLayout_md_reduce_padding_no_title_no_buttons, true);
    a.recycle();

    noTitlePaddingFull = r.getDimensionPixelSize(R.dimen.md_notitle_vertical_padding);
    buttonPaddingFull = r.getDimensionPixelSize(R.dimen.md_button_frame_vertical_padding);

    buttonHorizontalEdgeMargin = r.getDimensionPixelSize(R.dimen.md_button_padding_frame_side);
    buttonBarHeight = r.getDimensionPixelSize(R.dimen.md_button_height);

    dividerPaint = new Paint();
    dividerWidth = r.getDimensionPixelSize(R.dimen.md_divider_height);
    dividerPaint.setColor(DialogUtils.resolveColor(context, R.attr.md_divider_color));
    setWillNotDraw(false);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:MDRootLayout.java

示例5: TabSwitcherDrawable

import android.content.res.Resources; //導入方法依賴的package包/類
/**
 * Creates a new drawable, which allows to display the number of tabs, which are currently
 * contained by a {@link TabSwitcher}.
 *
 * @param context
 *         The context, which should be used by the drawable, as an instance of the class {@link
 *         Context}. The context may not be null
 */
public TabSwitcherDrawable(@NonNull final Context context) {
    ensureNotNull(context, "The context may not be null");
    Resources resources = context.getResources();
    size = resources.getDimensionPixelSize(R.dimen.tab_switcher_drawable_size);
    textSizeNormal =
            resources.getDimensionPixelSize(R.dimen.tab_switcher_drawable_font_size_normal);
    textSizeSmall =
            resources.getDimensionPixelSize(R.dimen.tab_switcher_drawable_font_size_small);
    background = ContextCompat.getDrawable(context, R.drawable.tab_switcher_drawable_background)
            .mutate();
    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(Color.WHITE);
    paint.setTextAlign(Align.CENTER);
    paint.setTextSize(textSizeNormal);
    paint.setTypeface(Typeface.create(Typeface.SANS_SERIF, Typeface.BOLD));
    label = Integer.toString(0);
    int tint = ThemeUtil.getColor(context, android.R.attr.textColorPrimary);
    setColorFilter(tint, PorterDuff.Mode.MULTIPLY);
}
 
開發者ID:michael-rapp,項目名稱:ChromeLikeTabSwitcher,代碼行數:28,代碼來源:TabSwitcherDrawable.java

示例6: AbstractDragTabsEventHandler

import android.content.res.Resources; //導入方法依賴的package包/類
/**
 * Creates a new drag handler, which allows to calculate the position and state of tabs on touch
 * events.
 *
 * @param tabSwitcher
 *         The tab switcher, whose tabs' positions and states should be calculated by the drag
 *         handler, as an instance of the class {@link TabSwitcher}. The tab switcher may not be
 *         null
 * @param arithmetics
 *         The arithmetics, which should be used to calculate the position, size and rotation of
 *         tabs, as an instance of the type {@link Arithmetics}. The arithmetics may not be
 *         null
 * @param swipeEnabled
 *         True, if tabs can be swiped on the orthogonal axis, false otherwise
 */
public AbstractDragTabsEventHandler(@NonNull final TabSwitcher tabSwitcher,
                                    @NonNull final Arithmetics arithmetics,
                                    final boolean swipeEnabled) {
    super(MIN_PRIORITY, tabSwitcher,
            tabSwitcher.getResources().getDimensionPixelSize(R.dimen.drag_threshold));
    ensureNotNull(arithmetics, "The arithmetics may not be null");
    this.arithmetics = arithmetics;
    this.swipeEnabled = swipeEnabled;
    Resources resources = tabSwitcher.getResources();
    this.swipeDragHelper =
            new DragHelper(resources.getDimensionPixelSize(R.dimen.swipe_threshold));
    this.callback = null;
    ViewConfiguration configuration = ViewConfiguration.get(tabSwitcher.getContext());
    this.minFlingVelocity = configuration.getScaledMinimumFlingVelocity();
    this.maxFlingVelocity = configuration.getScaledMaximumFlingVelocity();
    this.minSwipeVelocity = resources.getDimensionPixelSize(R.dimen.min_swipe_velocity);
    resetDragging();
}
 
開發者ID:michael-rapp,項目名稱:ChromeLikeTabSwitcher,代碼行數:34,代碼來源:AbstractDragTabsEventHandler.java

示例7: getNavigationBarHeight

import android.content.res.Resources; //導入方法依賴的package包/類
/**
 * 獲取NavigationBar的高度
 */
public static int getNavigationBarHeight(Context context) {
    int navigationBarHeight = 0;
    Resources rs = context.getApplicationContext().getResources();
    int id = rs.getIdentifier("navigation_bar_height", "dimen", "android");
    if (id > 0 && checkDeviceHasNavigationBar(context)) {
        navigationBarHeight = rs.getDimensionPixelSize(id);
    }
    return navigationBarHeight;
}
 
開發者ID:weimin96,項目名稱:shareNote,代碼行數:13,代碼來源:ScreenUtils.java

示例8: getStatusBarHeight

import android.content.res.Resources; //導入方法依賴的package包/類
/**
 * 獲取頂部status bar 高度
 */
public static int getStatusBarHeight(Activity mActivity) {
    Resources resources = mActivity.getResources();
    int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android");
    int height = resources.getDimensionPixelSize(resourceId);
    Log.i("height","Status height:" + height);
    return height;
}
 
開發者ID:haihaio,項目名稱:AmenWeather,代碼行數:11,代碼來源:Util.java

示例9: DualControlLayout

import android.content.res.Resources; //導入方法依賴的package包/類
/**
 * Construct a new DualControlLayout.
 *
 * See {@link ViewGroup} for parameter details.  attrs may be null if constructed dynamically.
 */
public DualControlLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    // Cache dimensions.
    Resources resources = getContext().getResources();
    mHorizontalMarginBetweenViews =
            resources.getDimensionPixelSize(R.dimen.infobar_control_margin_between_items);

    if (attrs != null) parseAttributes(attrs);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:16,代碼來源:DualControlLayout.java

示例10: PageIndicatorLineCaret

import android.content.res.Resources; //導入方法依賴的package包/類
public PageIndicatorLineCaret(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    Resources res = context.getResources();
    mLinePaint = new Paint();
    mLinePaint.setAlpha(0);

    mLauncher = Launcher.getLauncher(context);
    mLineHeight = res.getDimensionPixelSize(R.dimen.dynamic_grid_page_indicator_line_height);
    setCaretDrawable(new CaretDrawable(context));
}
 
開發者ID:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:12,代碼來源:PageIndicatorLineCaret.java

示例11: getInternalDimensionSize

import android.content.res.Resources; //導入方法依賴的package包/類
private int getInternalDimensionSize(Resources res, String key) {
    int result = 0;
    int resourceId = res.getIdentifier(key, "dimen", "android");
    if (resourceId > 0) {
        result = res.getDimensionPixelSize(resourceId);
    }
    return result;
}
 
開發者ID:medalionk,項目名稱:simple-share-android,代碼行數:9,代碼來源:SystemBarTintManager.java

示例12: getNavigationBarHeight

import android.content.res.Resources; //導入方法依賴的package包/類
public static int getNavigationBarHeight(Context context) {
    Resources resources = context.getResources();
    int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
    if (resourceId > 0) {
        return resources.getDimensionPixelSize(resourceId);
    }
    return 0;
}
 
開發者ID:victordiaz,項目名稱:phonk,代碼行數:9,代碼來源:AndroidUtils.java

示例13: getNavBarHeight

import android.content.res.Resources; //導入方法依賴的package包/類
public static int getNavBarHeight(Context context) {
    Resources resources = context.getResources();
    int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
    if (resourceId > 0) {
        return resources.getDimensionPixelSize(resourceId);
    }
    return 0;
}
 
開發者ID:lo625090140,項目名稱:lqrwechatrongcloud,代碼行數:9,代碼來源:UIUtils.java

示例14: CategoryListAdapter2

import android.content.res.Resources; //導入方法依賴的package包/類
public CategoryListAdapter2(Context context, CategoryTree<Category> categories) {
	this.inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	this.categories = categories;
       Resources resources = context.getResources();
       this.expandedDrawable = resources.getDrawable(R.drawable.expander_ic_maximized);
	this.collapsedDrawable = resources.getDrawable(R.drawable.expander_ic_minimized);
       this.incomeColor = resources.getColor(R.color.category_type_income);
       this.expenseColor = resources.getColor(R.color.category_type_expense);
       this.levelPadding = resources.getDimensionPixelSize(R.dimen.category_padding);
	recreatePlainList();
}
 
開發者ID:tiberiusteng,項目名稱:financisto1-holo,代碼行數:12,代碼來源:CategoryListAdapter2.java

示例15: TouchInterceptor

import android.content.res.Resources; //導入方法依賴的package包/類
public TouchInterceptor(Context context, AttributeSet attrs) {
    super(context, attrs);
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    Resources res = getResources();
    mItemHeightNormal = res.getDimensionPixelSize(R.dimen.normal_height);
    mItemHeightHalf = mItemHeightNormal / 2;
    mItemHeightExpanded = res.getDimensionPixelSize(R.dimen.expanded_height);
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:9,代碼來源:TouchInterceptor.java


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