本文整理汇总了Java中com.gc.materialdesign.R类的典型用法代码示例。如果您正苦于以下问题:Java R类的具体用法?Java R怎么用?Java R使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
R类属于com.gc.materialdesign包,在下文中一共展示了R类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.gc.materialdesign.R; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.number_indicator_spinner);
setCanceledOnTouchOutside(false);
RelativeLayout content = (RelativeLayout) this
.findViewById(R.id.number_indicator_spinner_content);
indicator = new Indicator(this.getContext());
content.addView(indicator);
numberIndicator = new TextView(getContext());
numberIndicator.setTextColor(Color.WHITE);
numberIndicator.setGravity(Gravity.CENTER);
content.addView(numberIndicator);
indicator.setLayoutParams(new RelativeLayout.LayoutParams(
LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
}
示例2: setAttributes
import com.gc.materialdesign.R; //导入依赖的package包/类
protected void setAttributes(AttributeSet attrs){
setBackgroundResource(R.drawable.background_button_rectangle);
//Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
if(bacgroundColor != -1){
setBackgroundColor(getResources().getColor(bacgroundColor));
}else{
// Color by hexadecimal
String background = attrs.getAttributeValue(ANDROIDXML,"background");
if(background != null)
setBackgroundColor(Color.parseColor(background));
else
setBackgroundColor(this.backgroundColor);
}
}
示例3: parseAttributes
import com.gc.materialdesign.R; //导入依赖的package包/类
/**
* Parse the attributes passed to the view from the XML
*
* @param a the attributes to parse
*/
private void parseAttributes(TypedArray a) {
barWidth = (int) a.getDimension(R.styleable.ProgressWheel_pwBarWidth, barWidth);
rimWidth = (int) a.getDimension(R.styleable.ProgressWheel_pwRimWidth, rimWidth);
spinSpeed = (int) a.getDimension(R.styleable.ProgressWheel_pwSpinSpeed, spinSpeed);
barLength = (int) a.getDimension(R.styleable.ProgressWheel_pwBarLength, barLength);
delayMillis = a.getInteger(R.styleable.ProgressWheel_pwDelayMillis, delayMillis);
if (delayMillis < 0) { delayMillis = 10; }
// Only set the text if it is explicitly defined
if (a.hasValue(R.styleable.ProgressWheel_pwText)) {
setText(a.getString(R.styleable.ProgressWheel_pwText));
}
barColor = a.getColor(R.styleable.ProgressWheel_pwBarColor, barColor);
textColor = a.getColor(R.styleable.ProgressWheel_pwTextColor, textColor);
rimColor = a.getColor(R.styleable.ProgressWheel_pwRimColor, rimColor);
circleColor = a.getColor(R.styleable.ProgressWheel_pwCircleColor, circleColor);
contourColor = a.getColor(R.styleable.ProgressWheel_pwContourColor, contourColor);
textSize = (int) a.getDimension(R.styleable.ProgressWheel_pwTextSize, textSize);
contourSize = a.getDimension(R.styleable.ProgressWheel_pwContourSize, contourSize);
a.recycle();
}
示例4: ButtonFloat
import com.gc.materialdesign.R; //导入依赖的package包/类
public ButtonFloat(Context context, AttributeSet attrs) {
super(context, attrs);
setBackgroundResource(R.drawable.background_button_float);
setBackgroundColor(backgroundColor);
sizeRadius = 28;
setDefaultProperties();
icon = new ImageView(context);
icon.setAdjustViewBounds(true);
icon.setScaleType(ScaleType.CENTER_CROP);
if(drawableIcon != null) {
icon.setImageDrawable(drawableIcon);
}
LayoutParams params = new LayoutParams(Utils.dpToPx(sizeIcon, getResources()),Utils.dpToPx(sizeIcon, getResources()));
params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
icon.setLayoutParams(params);
addView(icon);
}
示例5: onCreate
import com.gc.materialdesign.R; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.number_indicator_spinner);
setCanceledOnTouchOutside(false);
RelativeLayout content = (RelativeLayout) this
.findViewById(R.id.number_indicator_spinner_content);
indicator = new Indicator(this.getContext());
content.addView(indicator);
numberIndicator = new TextView(getContext());
numberIndicator.setTextColor(Color.WHITE);
numberIndicator.setGravity(Gravity.CENTER);
content.addView(numberIndicator);
indicator.setLayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.FILL_PARENT,
RelativeLayout.LayoutParams.FILL_PARENT));
}
示例6: setAttributes
import com.gc.materialdesign.R; //导入依赖的package包/类
@Override
protected void setAttributes(AttributeSet attrs) {
super.setAttributes(attrs);
boolean isChecked = attrs.getAttributeBooleanValue(MATERIALDESIGNXML, "checked", false);
if (isChecked) {
post(new Runnable() {
@Override
public void run() {
setChecked(true);
setPressed(false);
changeBackgroundColor(getResources().getColor(android.R.color.transparent));
}
});
}
float size = 20;
String checkBoxSize = attrs.getAttributeValue(MATERIALDESIGNXML, "checkBoxSize");
if (checkBoxSize != null) {
size = Utils.dipOrDpToFloat(checkBoxSize);
}
checkView = new Check(getContext());
setCheckBoxParams(size);
addView(checkView);
}
示例7: ButtonFloat
import com.gc.materialdesign.R; //导入依赖的package包/类
public ButtonFloat(Context context, AttributeSet attrs) {
super(context, attrs);
setBackgroundResource(R.drawable.background_button_float);
sizeRadius = 28;
setDefaultProperties();
icon = new ImageView(context);
icon.setAdjustViewBounds(true);
icon.setScaleType(ScaleType.CENTER_CROP);
if(drawableIcon != null) {
icon.setImageDrawable(drawableIcon);
}
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(Utils.dpToPx(sizeIcon, getResources()),Utils.dpToPx(sizeIcon, getResources()));
params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
icon.setLayoutParams(params);
addView(icon);
}
示例8: onCreate
import com.gc.materialdesign.R; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.number_indicator_spinner);
setCanceledOnTouchOutside(false);
RelativeLayout content = (RelativeLayout) this.findViewById(R.id.number_indicator_spinner_content);
indicator = new Indicator(this.getContext());
content.addView(indicator);
numberIndicator = new TextView(getContext());
numberIndicator.setTextColor(Color.WHITE);
numberIndicator.setGravity(Gravity.CENTER);
content.addView(numberIndicator);
indicator.setLayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.MATCH_PARENT));
}
示例9: ColorSelector2
import com.gc.materialdesign.R; //导入依赖的package包/类
public ColorSelector2(Context context, Integer color,
com.gc.materialdesign.widgets.ColorSelector.OnColorSelectedListener onColorSelectedListener2) {
super(context, android.R.style.Theme_Translucent);
this.onColorSelectedListener = onColorSelectedListener2;
if (color != null)
this.color = color;
setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if (ColorSelector2.this.onColorSelectedListener != null)
ColorSelector2.this.onColorSelectedListener.onColorSelected(ColorSelector2.this.color);
}
});
}
示例10: setAttributes
import com.gc.materialdesign.R; //导入依赖的package包/类
protected void setAttributes(AttributeSet attrs) {
setBackgroundResource(R.drawable.background_transparent);
// Set size of view
setMinimumHeight(Utils.dpToPx(48, getResources()));
setMinimumWidth(Utils.dpToPx(80, getResources()));
// Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,
"background", -1);
if (bacgroundColor != -1) {
setBackgroundColor(getResources().getColor(bacgroundColor));
} else {
// Color by hexadecimal
int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1)
setBackgroundColor(background);
}
check = attrs.getAttributeBooleanValue(MATERIALDESIGNXML, "check",
false);
eventCheck = check;
ball = new Ball(getContext());
RelativeLayout.LayoutParams params = new LayoutParams(Utils.dpToPx(20,
getResources()), Utils.dpToPx(20, getResources()));
params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
ball.setLayoutParams(params);
addView(ball);
}
示例11: onDraw
import com.gc.materialdesign.R; //导入依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!placedBall) {
placeBall();
}
// Crop line to transparent effect
if(null == bitmap) {
bitmap = Bitmap.createBitmap(canvas.getWidth(),
canvas.getHeight(), Bitmap.Config.ARGB_8888);
}
Canvas temp = new Canvas(bitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor((eventCheck) ? backgroundColor : Color.parseColor("#B0B0B0"));
paint.setStrokeWidth(Utils.dpToPx(2, getResources()));
temp.drawLine(getHeight() / 2, getHeight() / 2, getWidth()
- getHeight() / 2, getHeight() / 2, paint);
Paint transparentPaint = new Paint();
transparentPaint.setAntiAlias(true);
transparentPaint.setColor(getResources().getColor(
android.R.color.transparent));
transparentPaint.setXfermode(new PorterDuffXfermode(
PorterDuff.Mode.CLEAR));
temp.drawCircle(ViewHelper.getX(ball) + ball.getWidth() / 2,
ViewHelper.getY(ball) + ball.getHeight() / 2,
ball.getWidth() / 2, transparentPaint);
canvas.drawBitmap(bitmap, 0, 0, new Paint());
if (press) {
paint.setColor((check) ? makePressColor() : Color
.parseColor("#446D6D6D"));
canvas.drawCircle(ViewHelper.getX(ball) + ball.getWidth() / 2,
getHeight() / 2, getHeight() / 2, paint);
}
invalidate();
}
示例12: changeBackground
import com.gc.materialdesign.R; //导入依赖的package包/类
public void changeBackground() {
if (eventCheck) {
setBackgroundResource(R.drawable.background_checkbox);
LayerDrawable layer = (LayerDrawable) getBackground();
GradientDrawable shape = (GradientDrawable) layer
.findDrawableByLayerId(R.id.shape_bacground);
shape.setColor(backgroundColor);
} else {
setBackgroundResource(R.drawable.background_switch_ball_uncheck);
}
}
示例13: setDefaultProperties
import com.gc.materialdesign.R; //导入依赖的package包/类
protected void setDefaultProperties(){
minHeight = 36;
minWidth = 88;
rippleSize = 3;
// Min size
setMinimumHeight(Utils.dpToPx(minHeight, getResources()));
setMinimumWidth(Utils.dpToPx(minWidth, getResources()));
setBackgroundResource(R.drawable.background_transparent);
}
示例14: setDefaultProperties
import com.gc.materialdesign.R; //导入依赖的package包/类
protected void setDefaultProperties(){
rippleSpeed = Utils.dpToPx(2, getResources());
rippleSize = 10;
// Min size
setMinimumHeight(Utils.dpToPx(sizeRadius*2, getResources()));
setMinimumWidth(Utils.dpToPx(sizeRadius*2, getResources()));
// Background shape
setBackgroundResource(R.drawable.background_button_float);
// setBackgroundColor(backgroundColor);
}
示例15: setDefaultProperties
import com.gc.materialdesign.R; //导入依赖的package包/类
@Override
protected void setDefaultProperties(){
// paddingBottom = Utils.dpToPx(16, getResources());
// paddingLeft = Utils.dpToPx(16, getResources());
// paddingRight = Utils.dpToPx(16, getResources());
// paddingTop = Utils.dpToPx(16, getResources());
super.minWidth = 80;
super.minHeight = 36;
super.background = R.drawable.background_button_rectangle;
super.setDefaultProperties();
}