本文整理匯總了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;
}