java类android.graphics.drawable.GradientDrawable.Orientation的实例源码

ExpiryInfoView.java 文件源码 项目:QuizUpWinner 阅读 16 收藏 0 点赞 0 评论 0
private ExpiryInfoView(Context paramContext, String paramString)
{
  super(paramContext);
  RelativeLayout.LayoutParams localLayoutParams1 = new RelativeLayout.LayoutParams(-1, -1);
  setBackgroundColor(-1);
  setLayoutParams(localLayoutParams1);
  RelativeLayout.LayoutParams localLayoutParams2 = new RelativeLayout.LayoutParams(-1, (int)TypedValue.applyDimension(1, 3.0F, getResources().getDisplayMetrics()));
  localLayoutParams2.addRule(10, -1);
  ImageView localImageView = new ImageView(paramContext);
  localImageView.setLayoutParams(localLayoutParams2);
  int[] arrayOfInt = { -16777216, 0 };
  localImageView.setBackgroundDrawable(new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, arrayOfInt));
  addView(localImageView);
  int i = (int)TypedValue.applyDimension(1, 20.0F, getResources().getDisplayMetrics());
  RelativeLayout.LayoutParams localLayoutParams3 = new RelativeLayout.LayoutParams(-1, -2);
  localLayoutParams3.addRule(13, -1);
  localLayoutParams3.setMargins(i, i, i, i);
  TextView localTextView = new TextView(paramContext);
  localTextView.setGravity(17);
  localTextView.setLayoutParams(localLayoutParams3);
  localTextView.setText(paramString);
  localTextView.setTextColor(-16777216);
  addView(localTextView);
}
AbLetterFilterListView.java 文件源码 项目:androidsummary 阅读 15 收藏 0 点赞 0 评论 0
/**
 * Inits the.
 */
private void init() {
    l = new char[] {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
            'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
            'X', 'Y', 'Z', '#' };
    paint = new Paint();
    paint.setColor(Color.parseColor("#949494"));
    paint.setTypeface(Typeface.DEFAULT_BOLD);
    paint.setTextSize(22);
    paint.setAntiAlias(true);
    paint.setTextAlign(Paint.Align.CENTER);

    gradientDrawable = new GradientDrawable(Orientation.BOTTOM_TOP, new int []{0x99B0B0B0,0x99B0B0B0});
    gradientDrawable.setCornerRadius(30);

}
WheelView.java 文件源码 项目:bither-android 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(R.drawable.wheel_val);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(R.drawable.wheel_bg);
}
WheelView.java 文件源码 项目:WikiCards 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(wheelForeground);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(wheelBackground);
}
WheelView.java 文件源码 项目:popcorntime-android-kitkat 阅读 32 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(R.drawable.wheel_val);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(R.drawable.wheel_bg);
}
ColorButton.java 文件源码 项目:androidsoft-coloring 阅读 24 收藏 0 点赞 0 评论 0
public ColorButton(Context context, AttributeSet attrs, int defStyle)
{
    super(context, attrs, defStyle);

    TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.ColorButton, defStyle, 0);
    _color = a.getColor(R.styleable.ColorButton_color, Color.RED);
    a.recycle();

    _highlightDrawable = new GradientDrawable(Orientation.TOP_BOTTOM,
            new int[]
            {
                Color.WHITE, Color.TRANSPARENT, Color.TRANSPARENT
            });
    _highlightDrawable.setShape(GradientDrawable.OVAL);
    _colorDrawable = new GradientDrawable();
    _colorDrawable.setColor(_color);
    _colorDrawable.setShape(GradientDrawable.OVAL);
}
ColorButton.java 文件源码 项目:androidsoft-kids-coloring 阅读 20 收藏 0 点赞 0 评论 0
public ColorButton(Context context, AttributeSet attrs, int defStyle)
{
    super(context, attrs, defStyle);

    TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.ColorButton, defStyle, 0);
    _color = a.getColor(R.styleable.ColorButton_color, Color.RED);

    _highlightDrawable = new GradientDrawable(Orientation.TOP_BOTTOM,
            new int[]
            {
                Color.WHITE, Color.TRANSPARENT, Color.TRANSPARENT
            });
    _highlightDrawable.setShape(GradientDrawable.OVAL);
    _colorDrawable = new GradientDrawable();
    _colorDrawable.setColor(_color);
    _colorDrawable.setShape(GradientDrawable.OVAL);
}
ColorPickerAdvancedComponent.java 文件源码 项目:android-chromium-view 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Initializes the views.
 *
 * @param rootView View that contains all the content, such as the label, gradient view, etc.
 * @param textResourceId The resource ID of the text to show on the label.
 * @param seekBarMax The range of the seek bar.
 * @param seekBarListener The listener for when the seek bar value changes.
 */
ColorPickerAdvancedComponent(final View rootView,
        final int textResourceId,
        final int seekBarMax,
        final OnSeekBarChangeListener seekBarListener) {
    mGradientView = rootView.findViewById(R.id.gradient);
    mText = (TextView) rootView.findViewById(R.id.text);
    mText.setText(textResourceId);
    mGradientDrawable = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, null);
    mSeekBar = (SeekBar) rootView.findViewById(R.id.seek_bar);
    mSeekBar.setOnSeekBarChangeListener(seekBarListener);
    mSeekBar.setMax(seekBarMax);
    // Setting the thumb offset means the seek bar thumb can move all the way to each end
    // of the gradient view.
    Context context = rootView.getContext();
    int offset = context.getResources()
                        .getDrawable(R.drawable.color_picker_advanced_select_handle)
                        .getIntrinsicWidth();
    mSeekBar.setThumbOffset(offset / 2);
}
WheelView.java 文件源码 项目:ouser 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(R.drawable.wheel_val);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(R.drawable.wheel_bg);
}
WheelView.java 文件源码 项目:iHelp-android 阅读 34 收藏 0 点赞 0 评论 0
/**
 * Initializes resources 
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(R.drawable.wheel_val);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(R.drawable.wheel_bg);
}


问题


面经


文章

微信
公众号

扫码关注公众号