当前位置: 首页>>代码示例>>Java>>正文


Java LayoutParams类代码示例

本文整理汇总了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);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:18,代码来源:NewVideosActionProvider.java

示例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();
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:17,代码来源:LatinIME.java

示例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);
	}
 
开发者ID:yiwent,项目名称:Mobike,代码行数:18,代码来源:EditPage.java

示例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);
}
 
开发者ID:Horrarndoo,项目名称:YiZhi,代码行数:17,代码来源:EditPage.java

示例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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:PullToRefreshView.java

示例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();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:22,代码来源:MyDownloadActivity.java

示例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);
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:19,代码来源:WXViewUtils.java

示例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;
      }
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:17,代码来源:ThankDialog.java

示例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;
}
 
开发者ID:JessYanCoding,项目名称:ProgressManager,代码行数:17,代码来源:a.java

示例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;
}
 
开发者ID:Leanplum,项目名称:Leanplum-Android-SDK,代码行数:22,代码来源:BaseMessageDialog.java

示例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;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:18,代码来源:PullToRefreshBase.java

示例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);
}
 
开发者ID:xiaoshanlin000,项目名称:SLTableView,代码行数:27,代码来源:OptionsPopupWindow.java

示例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;
}
 
开发者ID:jeremyup,项目名称:cordova-plugin-x5-webview,代码行数:28,代码来源:X5WebChromeClient.java

示例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;
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:26,代码来源:WXRenderStatement.java

示例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};
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:AsyncImageView.java


注:本文中的android.view.ViewGroup.LayoutParams类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。