本文整理汇总了Java中android.view.ViewGroup.LayoutParams类的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams类的具体用法?Java LayoutParams怎么用?Java LayoutParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LayoutParams类属于android.view.ViewGroup包,在下文中一共展示了LayoutParams类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DropDownWindow
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
public DropDownWindow(View anchor, View contentView) {
super(anchor.getContext());
mAnchor = anchor;
final Resources r = anchor.getResources();
setBackgroundDrawable(r.getDrawable(R.drawable.dialog_full_holo_dark));
setWidth(r.getDimensionPixelSize(R.dimen.new_videos_action_dropdown_width)); // Takes too much space on tablets when using LayoutParams.WRAP_CONTENT
setHeight(LayoutParams.WRAP_CONTENT);
setContentView(contentView);
setTouchable(true);
setFocusable(true);
// listen to anchor getting removed (e.g. activity destroyed)
// -> dismiss() self so we don't keep this window open
anchor.addOnAttachStateChangeListener(this);
}
示例2: showOptionDialog
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
private void showOptionDialog(final AlertDialog dialog) {
final IBinder windowToken = mKeyboardSwitcher.getMainKeyboardView().getWindowToken();
if (windowToken == null) {
return;
}
final Window window = dialog.getWindow();
final WindowManager.LayoutParams lp = window.getAttributes();
lp.token = windowToken;
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
window.setAttributes(lp);
window.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
mOptionsDialog = dialog;
dialog.show();
}
示例3: setActivity
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
public void setActivity(Activity activity) {
super.setActivity(activity);
if (isDialogMode()) {
System.err.println("Theme classic does not support dialog mode!");
// activity.setTheme(android.R.style.Theme_Dialog);
// activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
// if (Build.VERSION.SDK_INT >= 11) {
// try {
// ReflectHelper.invokeInstanceMethod(activity, "setFinishOnTouchOutside", false);
// } catch (Throwable e) {}
// }
}
activity.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE |
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
}
示例4: onSetTheme
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
@Override
protected int onSetTheme(int resid, boolean atLaunch) {
if (isDialogMode()) {
activity.requestWindowFeature(Window.FEATURE_NO_TITLE);
if (Build.VERSION.SDK_INT >= 11) {
try {
ReflectHelper.invokeInstanceMethod(activity, "setFinishOnTouchOutside", false);
} catch (Throwable e) {}
}
return android.R.style.Theme_Dialog;
} else {
activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE
| WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
}
return super.onSetTheme(resid, atLaunch);
}
示例5: setAdapter
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
public void setAdapter(PullToRefreshAdatper pullToRefreshAdatper) {
this.adapter = pullToRefreshAdatper;
removeAllViews();
this.bodyView = (View) pullToRefreshAdatper.getBodyView();
LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, -1);
layoutParams.addRule(9, -1);
layoutParams.addRule(11, -1);
layoutParams.addRule(10, -1);
addView(this.bodyView, layoutParams);
this.headerView = pullToRefreshAdatper.getHeaderView();
this.headerView.measure(0, 0);
this.headerHeight = this.headerView.getMeasuredHeight();
layoutParams = new RelativeLayout.LayoutParams(-2, this.headerHeight);
layoutParams.addRule(9, -1);
layoutParams.addRule(11, -1);
layoutParams.addRule(10, -1);
layoutParams.topMargin = -this.headerHeight;
addView(this.headerView, layoutParams);
}
示例6: doTabPageIndicatorAnimator
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
private void doTabPageIndicatorAnimator(int start, int end) {
this.mTabPIValueAnimator = ValueAnimator.ofInt(new int[]{start, end});
this.mTabPIValueAnimator.addUpdateListener(new AnimatorUpdateListener(this) {
final /* synthetic */ MyDownloadActivity this$0;
{
if (HotFix.PREVENT_VERIFY) {
System.out.println(VerifyLoad.class);
}
this.this$0 = this$0;
}
public void onAnimationUpdate(ValueAnimator animation) {
int value = ((Integer) animation.getAnimatedValue()).intValue();
LayoutParams layoutParams = this.this$0.mIndicator.getLayoutParams();
layoutParams.height = value;
this.this$0.mIndicator.setLayoutParams(layoutParams);
}
});
this.mTabPIValueAnimator.start();
}
示例7: onScreenArea
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
public static boolean onScreenArea(View view) {
if (view == null || view.getVisibility() != View.VISIBLE) {
return false;
}
int[] p = new int[2];
view.getLocationOnScreen(p);
LayoutParams lp = view.getLayoutParams();
int viewH = 0;
if (lp != null) {
viewH = lp.height;
} else {
viewH = view.getHeight();
}
return (p[1] > 0 && (p[1] - WXViewUtils.getScreenHeight(WXEnvironment.sApplication) < 0))
|| (viewH + p[1] > 0 && p[1] <= 0);
}
示例8: create
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public ThankDialog create() {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final ThankDialog dialog = new ThankDialog(context, ResourceUtils.getIdByName(context, "style", "sobot_Dialog"));
dialog.setCanceledOnTouchOutside(false);
View layout = inflater.inflate(ResourceUtils.getIdByName(context, "layout", "sobot_thank_dialog_layout"), null);
dialog.addContentView(layout, new LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
if (message != null) {
((TextView) layout.findViewById(ResourceUtils.getIdByName(context, "id", "sobot_message"))).setText(message);
}
dialog.setContentView(layout);
return dialog;
}
示例9: dispatchPopulateAccessibilityEvent
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
event.setClassName(getClass().getName());
event.setPackageName(getPackageName());
LayoutParams params = getWindow().getAttributes();
boolean isFullScreen = (params.width == LayoutParams.MATCH_PARENT) &&
(params.height == LayoutParams.MATCH_PARENT);
event.setFullScreen(isFullScreen);
CharSequence title = getTitle();
if (!TextUtils.isEmpty(title)) {
event.getText().add(title);
}
return true;
}
示例10: createTitleView
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
private RelativeLayout createTitleView(Context context) {
RelativeLayout view = new RelativeLayout(context);
view.setLayoutParams(new LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
TextView title = new TextView(context);
title.setPadding(0, SizeUtil.dp5, 0, SizeUtil.dp5);
title.setGravity(Gravity.CENTER);
title.setText(options.getTitle());
title.setTextColor(options.getTitleColor());
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, SizeUtil.textSize0);
title.setTypeface(null, Typeface.BOLD);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
title.setLayoutParams(layoutParams);
view.addView(title, title.getLayoutParams());
return view;
}
示例11: updateUIForMode
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
protected void updateUIForMode() {
LinearLayout.LayoutParams lp = getLoadingLayoutLayoutParams();
if (this == this.mHeaderLayout.getParent()) {
removeView(this.mHeaderLayout);
}
if (this.mMode.showHeaderLoadingLayout()) {
addViewInternal(this.mHeaderLayout, 0, lp);
}
if (this == this.mFooterLayout.getParent()) {
removeView(this.mFooterLayout);
}
if (this.mMode.showFooterLoadingLayout()) {
addViewInternal(this.mFooterLayout, lp);
}
refreshLoadingViewsSize();
this.mCurrentMode = this.mMode != Mode.BOTH ? this.mMode : Mode.PULL_FROM_START;
}
示例12: OptionsPopupWindow
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
public OptionsPopupWindow(Context context) {
super(context);
this.setWidth(LayoutParams.FILL_PARENT);
this.setHeight(LayoutParams.WRAP_CONTENT);
this.setBackgroundDrawable(new BitmapDrawable());// 这样设置才能点击屏幕外dismiss窗口
this.setOutsideTouchable(true);
this.setAnimationStyle(R.style.timepopwindow_anim_style);
LayoutInflater mLayoutInflater = LayoutInflater.from(context);
rootView = mLayoutInflater.inflate(R.layout.pw_options, null);
// -----确定和取消按钮
btnSubmit = rootView.findViewById(R.id.btnSubmit);
btnSubmit.setTag(TAG_SUBMIT);
btnCancel = rootView.findViewById(R.id.btnCancel);
btnCancel.setTag(TAG_CANCEL);
btnSubmit.setOnClickListener(this);
btnCancel.setOnClickListener(this);
// ----转轮
final View optionspicker = rootView.findViewById(R.id.optionspicker);
ScreenInfo screenInfo = new ScreenInfo((Activity) context);
wheelOptions = new WheelOptions(optionspicker);
wheelOptions.screenheight = screenInfo.getHeight();
setContentView(rootView);
}
示例13: getVideoLoadingProgressView
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
/**
* Ask the host application for a custom progress view to show while
* a <video> is loading.
* @return View The progress view.
*/
public View getVideoLoadingProgressView() {
if (mVideoProgressView == null) {
// Create a new Loading view programmatically.
// create the linear layout
LinearLayout layout = new LinearLayout(parentEngine.getView().getContext());
layout.setOrientation(LinearLayout.VERTICAL);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
layout.setLayoutParams(layoutParams);
// the proress bar
ProgressBar bar = new ProgressBar(parentEngine.getView().getContext());
LinearLayout.LayoutParams barLayoutParams = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
barLayoutParams.gravity = Gravity.CENTER;
bar.setLayoutParams(barLayoutParams);
layout.addView(bar);
mVideoProgressView = layout;
}
return mVideoProgressView;
}
示例14: createBodyOnDomThread
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
WXComponent createBodyOnDomThread(WXDomObject dom) {
if (mWXSDKInstance == null) {
return null;
}
WXDomObject domObject = new WXDomObject();
WXDomObject.prepareGod(domObject);
mGodComponent = (WXVContainer) WXComponentFactory.newInstance(mWXSDKInstance, domObject, null);
mGodComponent.createView(null, -1);
if (mGodComponent == null) {
if (WXEnvironment.isApkDebugable()) {
WXLogUtils.e("rootView failed!");
}
//TODO error callback
return null;
}
FrameLayout frameLayout = (FrameLayout) mGodComponent.getHostView();
ViewGroup.LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
frameLayout.setLayoutParams(layoutParams);
frameLayout.setBackgroundColor(Color.TRANSPARENT);
WXComponent component = generateComponentTree(dom, mGodComponent);
mGodComponent.addChild(component);
mRegistry.put(component.getRef(), component);
return component;
}
示例15: getSize
import android.view.ViewGroup.LayoutParams; //导入依赖的package包/类
private int[] getSize() {
int width = getWidth();
int height = getHeight();
if (width == 0 || height == 0) {
LayoutParams layoutParams = getLayoutParams();
if (layoutParams != null) {
width = layoutParams.width;
height = layoutParams.height;
}
}
if (width == 0 || r0 == 0) {
measure(0, 0);
width = getMeasuredWidth();
height = getMeasuredHeight();
}
return new int[]{width, height};
}