本文整理汇总了Java中android.util.AttributeSet.getStyleAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java AttributeSet.getStyleAttribute方法的具体用法?Java AttributeSet.getStyleAttribute怎么用?Java AttributeSet.getStyleAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.util.AttributeSet
的用法示例。
在下文中一共展示了AttributeSet.getStyleAttribute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadDefaultStyle
import android.util.AttributeSet; //导入方法依赖的package包/类
/**
* 加载默认的样式(蓝色)。
*
* @param attrs XML 属性集合对象
*/
private void loadDefaultStyle(AttributeSet attrs) {
if (attrs != null && 0 == attrs.getStyleAttribute()) {
Resources res = getResources();
this.setBackgroundResource(R.drawable.com_sina_weibo_sdk_button_blue);
this.setPadding(res.getDimensionPixelSize(R.dimen.com_sina_weibo_sdk_loginview_padding_left),
res.getDimensionPixelSize(R.dimen.com_sina_weibo_sdk_loginview_padding_top),
res.getDimensionPixelSize(R.dimen.com_sina_weibo_sdk_loginview_padding_right),
res.getDimensionPixelSize(R.dimen.com_sina_weibo_sdk_loginview_padding_bottom));
this.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_com_sina_weibo_sdk_logo, 0, 0, 0);
this.setCompoundDrawablePadding(
res.getDimensionPixelSize(R.dimen.com_sina_weibo_sdk_loginview_compound_drawable_padding));
this.setTextColor(res.getColor(R.color.com_sina_weibo_sdk_loginview_text_color));
this.setTextSize(TypedValue.COMPLEX_UNIT_PX,
res.getDimension(R.dimen.com_sina_weibo_sdk_loginview_text_size));
this.setTypeface(Typeface.DEFAULT_BOLD);
this.setGravity(Gravity.CENTER);
this.setText(R.string.com_sina_weibo_sdk_login_with_weibo_account);
}
}
示例2: LoginButton
import android.util.AttributeSet; //导入方法依赖的package包/类
/**
* Create the LoginButton by inflating from XML
*
* @see View#View(Context, AttributeSet)
*/
public LoginButton(Context context, AttributeSet attrs) {
super(context, attrs);
if (attrs.getStyleAttribute() == 0) {
// apparently there's no method of setting a default style in xml,
// so in case the users do not explicitly specify a style, we need
// to use sensible defaults.
this.setGravity(Gravity.CENTER);
this.setTextColor(getResources().getColor(R.color.com_facebook_loginview_text_color));
this.setTextSize(TypedValue.COMPLEX_UNIT_PX,
getResources().getDimension(R.dimen.com_facebook_loginview_text_size));
this.setTypeface(Typeface.DEFAULT_BOLD);
if (isInEditMode()) {
// cannot use a drawable in edit mode, so setting the background color instead
// of a background resource.
this.setBackgroundColor(getResources().getColor(R.color.com_facebook_blue));
// hardcoding in edit mode as getResources().getString() doesn't seem to work in IntelliJ
loginText = "Log in with Facebook";
} else {
this.setBackgroundResource(R.drawable.com_facebook_button_blue);
this.setCompoundDrawablesWithIntrinsicBounds(R.drawable.com_facebook_inverse_icon, 0, 0, 0);
this.setCompoundDrawablePadding(
getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_compound_drawable_padding));
this.setPadding(getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_left),
getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_top),
getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_right),
getResources().getDimensionPixelSize(R.dimen.com_facebook_loginview_padding_bottom));
}
}
parseAttributes(attrs);
if (!isInEditMode()) {
initializeActiveSessionWithCachedToken(context);
}
}
示例3: getIconCardViewStyle
import android.util.AttributeSet; //导入方法依赖的package包/类
private static int getIconCardViewStyle(Context context, AttributeSet attrs, int defStyleAttr) {
int style = attrs == null ? 0 : attrs.getStyleAttribute();
if (style == 0) {
TypedArray styledAttrs = context.obtainStyledAttributes(R.styleable.OverlayCardView);
style = styledAttrs.getResourceId(R.styleable.OverlayCardView_overlay_theme, 0);
styledAttrs.recycle();
}
return style;
}
示例4: getIconCardViewStyle
import android.util.AttributeSet; //导入方法依赖的package包/类
private static int getIconCardViewStyle(Context context, AttributeSet attrs, int defStyleAttr) {
int style = attrs == null ? 0 : attrs.getStyleAttribute();
if (style == 0) {
TypedArray styledAttrs = context.obtainStyledAttributes(R.styleable.IconCardView);
style = styledAttrs.getResourceId(R.styleable.IconCardView_icon_theme, 0);
styledAttrs.recycle();
}
return style;
}
示例5: getLoadingCardViewStyle
import android.util.AttributeSet; //导入方法依赖的package包/类
private static int getLoadingCardViewStyle(Context context, AttributeSet attrs, int defStyleAttr) {
int style = attrs == null ? 0 : attrs.getStyleAttribute();
if (style == 0) {
TypedArray styledAttrs = context.obtainStyledAttributes(R.styleable.LoadingCardView);
style = styledAttrs.getResourceId(R.styleable.LoadingCardView_loading_theme, 0);
styledAttrs.recycle();
}
return style;
}
示例6: getIconCardViewStyle
import android.util.AttributeSet; //导入方法依赖的package包/类
private static int getIconCardViewStyle(Context context, AttributeSet attrs, int defStyleAttr) {
int style = attrs == null ? 0 : attrs.getStyleAttribute();
if (style == 0) {
TypedArray styledAttrs = context.obtainStyledAttributes(R.styleable.ProcessCardView);
style = styledAttrs.getResourceId(R.styleable.ProcessCardView_process_theme, 0);
styledAttrs.recycle();
}
return style;
}