本文整理了Java中android.app.Activity.obtainStyledAttributes()
方法的一些代码示例,展示了Activity.obtainStyledAttributes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.obtainStyledAttributes()
方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:obtainStyledAttributes
暂无
代码示例来源:origin: stackoverflow.com
/**
* Parse attributes during inflation from a view hierarchy into the
* arguments we handle.
*/
@Override
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
super.onInflate(activity, attrs, savedInstanceState);
Log.v(TAG,"onInflate called");
TypedArray a = activity.obtainStyledAttributes(attrs,R.styleable.MyFragment);
CharSequence myString = a.getText(R.styleable.MyFragment_my_string);
if(myString != null) {
Log.v(TAG, "My String Received : " + myString.toString());
}
int myInteger = a.getInt(R.styleable.AdFragment_my_integer, -1);
if(myInteger != -1) {
Log.v(TAG,"My Integer Received :" + myInteger);
}
a.recycle();
}
代码示例来源:origin: facebook/facebook-android-sdk
@Override
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
super.onInflate(activity, attrs, savedInstanceState);
TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.picker_friend_picker_fragment);
setMultiSelect(a.getBoolean(R.styleable.picker_friend_picker_fragment_multi_select, multiSelect));
a.recycle();
}
代码示例来源:origin: facebook/facebook-android-sdk
@Override
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
super.onInflate(activity, attrs, savedInstanceState);
TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.picker_fragment);
setShowPictures(a.getBoolean(R.styleable.picker_fragment_show_pictures, showPictures));
String extraFieldsString = a.getString(R.styleable.picker_fragment_extra_fields);
if (extraFieldsString != null) {
String[] strings = extraFieldsString.split(",");
setExtraFields(Arrays.asList(strings));
}
showTitleBar = a.getBoolean(R.styleable.picker_fragment_show_title_bar, showTitleBar);
titleText = a.getString(R.styleable.picker_fragment_title_text);
doneButtonText = a.getString(R.styleable.picker_fragment_done_button_text);
titleBarBackground = a.getDrawable(R.styleable.picker_fragment_title_bar_background);
doneButtonBackground = a.getDrawable(R.styleable.picker_fragment_done_button_background);
a.recycle();
}
代码示例来源:origin: facebook/facebook-android-sdk
@Override
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
super.onInflate(activity, attrs, savedInstanceState);
TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.picker_place_picker_fragment);
setRadiusInMeters(a.getInt(R.styleable.picker_place_picker_fragment_radius_in_meters, radiusInMeters));
setResultsLimit(a.getInt(R.styleable.picker_place_picker_fragment_results_limit, resultsLimit));
if (a.hasValue(R.styleable.picker_place_picker_fragment_results_limit)) {
setSearchText(a.getString(R.styleable.picker_place_picker_fragment_search_text));
}
showSearchBox = a.getBoolean(R.styleable.picker_place_picker_fragment_show_search_box, showSearchBox);
a.recycle();
}
代码示例来源:origin: wangdan/AisenWeiBo
public WebURLEmotionSpan(Context context, Bitmap b, String url, int type, int verticalAlignment) {
super(context, b, verticalAlignment);
int[] attrs = new int[] { org.aisen.android.R.attr.colorPrimary };
Activity activity = BaseActivity.getRunningActivity();
if (activity != null) {
TypedArray ta = activity.obtainStyledAttributes(attrs);
mColor = ta.getColor(0, Color.BLUE);
}
else {
mColor = Color.BLUE;
}
mType = type;
mURL = url;
mBackgroundPaint = new Paint();
mBackgroundPaint.setColor(Color.parseColor("#33969696"));
if (mType == VideoService.TYPE_VIDEO_SINA ||
mType == VideoService.TYPE_VIDEO_WEIPAI) {
mReplaceText = "秒拍视频";
}
else if (mType == VideoService.TYPE_VIDEO_MEIPAI) {
mReplaceText = "美拍视频";
}
else if (mType == VideoService.TYPE_PHOTO) {
mReplaceText = "查看图片";
}
else {
mReplaceText = "网页链接";
}
}
代码示例来源:origin: nickbutcher/plaid
final TypedArray a = host.obtainStyledAttributes(R.styleable.DribbbleFeed);
final int loadingColorArrayId =
a.getResourceId(R.styleable.DribbbleFeed_shotLoadingPlaceholderColors, 0);
代码示例来源:origin: zwwill/yanxuan-weex-demo
public static int getDisplayHeight(Activity activity) {
int height = 0;
if (activity != null && activity.getWindowManager() != null && activity.getWindowManager().getDefaultDisplay() != null) {
Point point=new Point();
activity.getWindowManager().getDefaultDisplay().getSize(point);
height=point.y;
}
Log.e(TAG, "isSupportSmartBar:" + isSupportSmartBar);
if (isSupportSmartBar) {
int smartBarHeight = getSmartBarHeight(activity);
Log.e(TAG, "smartBarHeight:" + smartBarHeight);
height -= smartBarHeight;
}
if (activity != null && activity.getActionBar() != null) {
int actionbar= activity.getActionBar().getHeight();
if(actionbar==0){
TypedArray actionbarSizeTypedArray=activity.obtainStyledAttributes(new int[]{android.R.attr.actionBarSize});
actionbar= (int) actionbarSizeTypedArray.getDimension(0,0);
}
Log.d(TAG, "actionbar:" + actionbar);
height -= actionbar;
}
int status = getStatusBarHeight(activity);
Log.d(TAG, "status:" + status);
height -= status;
Log.d(TAG,"height:"+height);
return height;
}
代码示例来源:origin: TommyLemon/APIJSON
TypedArray a = activity.obtainStyledAttributes(attrs);
try {
mStatusBarAvailable = a.getBoolean(0, false);
代码示例来源:origin: TommyLemon/Android-ZBLibrary
TypedArray a = activity.obtainStyledAttributes(attrs);
try {
mStatusBarAvailable = a.getBoolean(0, false);
代码示例来源:origin: jeasonlzy/ImagePicker
TypedArray a = activity.obtainStyledAttributes(attrs);
try {
mStatusBarAvailable = a.getBoolean(0, false);
代码示例来源:origin: Naoki2015/CircleDemo
TypedArray a = activity.obtainStyledAttributes(attrs);
try {
mStatusBarAvailable = a.getBoolean(0, false);
代码示例来源:origin: joyoyao/superCleanMaster
TypedArray a = activity.obtainStyledAttributes(attrs);
try {
mStatusBarAvailable = a.getBoolean(0, false);
代码示例来源:origin: nanchen2251/RxJava2Examples
TypedArray a = activity.obtainStyledAttributes(attrs);
try {
mStatusBarAvailable = a.getBoolean(0, false);
代码示例来源:origin: android-hacker/VirtualXposed
public static void fixActivity(Activity activity) {
Context baseContext = activity.getBaseContext();
try {
TypedArray typedArray = activity.obtainStyledAttributes((R_Hide.styleable.Window.get()));
if (typedArray != null) {
boolean showWallpaper = typedArray.getBoolean(R_Hide.styleable.Window_windowShowWallpaper.get(),
代码示例来源:origin: sjwall/MaterialTapTargetPrompt
@NonNull
@Override
public TypedArray obtainStyledAttributes(@StyleRes int resId, @StyleableRes int[] attrs)
{
return mActivity.obtainStyledAttributes(resId, attrs);
}
代码示例来源:origin: com.uphyca/android-junit4-robolectric
/**
* @param set
* @param attrs
* @return
* @see android.content.Context#obtainStyledAttributes(android.util.AttributeSet,
* int[])
*/
public final TypedArray obtainStyledAttributes(AttributeSet set,
int[] attrs) {
return mActivity.obtainStyledAttributes(set, attrs);
}
代码示例来源:origin: com.uphyca/android-junit4-robolectric
/**
* @param attrs
* @return
* @see android.content.Context#obtainStyledAttributes(int[])
*/
public final TypedArray obtainStyledAttributes(int[] attrs) {
return mActivity.obtainStyledAttributes(attrs);
}
代码示例来源:origin: andforce/iBeebo
public static int getColor(Activity activity, int attr) {
int[] attrs = new int[]{
attr
};
TypedArray ta = activity.obtainStyledAttributes(attrs);
int color = ta.getColor(0, 430);
ta.recycle();
return color;
}
代码示例来源:origin: andforce/iBeebo
public static int getDimensionPixelSize(Activity activity, int attr, int defaultValue) {
int[] attrs = new int[]{
attr
};
TypedArray ta = activity.obtainStyledAttributes(attrs);
int value = ta.getDimensionPixelSize(0, defaultValue);
ta.recycle();
return value;
}
代码示例来源:origin: fr.avianey/facebook-android-api
@Override
public void onInflate(Activity activity, AttributeSet attrs, Bundle savedInstanceState) {
super.onInflate(activity, attrs, savedInstanceState);
TypedArray a = activity.obtainStyledAttributes(attrs, R.styleable.com_facebook_place_picker_fragment);
setRadiusInMeters(a.getInt(R.styleable.com_facebook_place_picker_fragment_radius_in_meters, radiusInMeters));
setResultsLimit(a.getInt(R.styleable.com_facebook_place_picker_fragment_results_limit, resultsLimit));
if (a.hasValue(R.styleable.com_facebook_place_picker_fragment_results_limit)) {
setSearchText(a.getString(R.styleable.com_facebook_place_picker_fragment_search_text));
}
showSearchBox = a.getBoolean(R.styleable.com_facebook_place_picker_fragment_show_search_box, showSearchBox);
a.recycle();
}
内容来源于网络,如有侵权,请联系作者删除!