android.widget.RelativeLayout.LayoutParams#MATCH_PARENT源码实例Demo

下面列出了android.widget.RelativeLayout.LayoutParams#MATCH_PARENT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: douyin   文件: InfoAdapter.java
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup parent, int viewType) {
    RelativeLayout layout = new RelativeLayout(getContext());
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, dp2px(45));
    layout.setLayoutParams(layoutParams);

    TextView title = new TextView(getContext());
    title.setId(0);
    LayoutParams title_params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    title_params.addRule(RelativeLayout.CENTER_VERTICAL);
    title_params.setMargins(dp2px(18), 0, 0, 0);
    title.setLayoutParams(title_params);

    TextView subTitle = new TextView(getContext());
    subTitle.setId(1);
    LayoutParams subTitle_params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    subTitle_params.addRule(RelativeLayout.CENTER_VERTICAL);
    subTitle_params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    subTitle_params.setMargins(0, 0, dp2px(20), 0);
    subTitle.setLayoutParams(subTitle_params);

    layout.addView(title);
    layout.addView(subTitle);
    return layout;
}
 
源代码2 项目: CoreModule   文件: BrowserDelegate.java
@Override
public void initWidget() {
    super.initWidget();
    webView = get(R.id.webview);
    mLayoutBottom = (LinearLayout) View.inflate(getActivity(),
            R.layout.item_browser_bottombar, null);
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams
            .WRAP_CONTENT);
    params.leftMargin = 60;
    params.rightMargin = 60;
    params.bottomMargin = 30;
    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    ((RelativeLayout) get(R.id.browser_root)).addView(mLayoutBottom, 1, params);
    mLayoutBottom.setVisibility(View.GONE);

    new BrowserDelegateOption(this, linkDispatcher).initWebView();
}
 
源代码3 项目: financisto   文件: NodeInflater.java
public EditBuilder(LinearLayout layout, View view) {
    super(layout, R.layout.select_entry_edit);
    RelativeLayout relativeLayout = v.findViewById(R.id.layout);
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    layoutParams.addRule(RelativeLayout.ALIGN_LEFT, R.id.label);
    layoutParams.addRule(RelativeLayout.BELOW, R.id.label);
    relativeLayout.addView(view, layoutParams);
}
 
源代码4 项目: LLApp   文件: AbsBaseSwipeBackActivity.java
private View getContainer() {
    RelativeLayout container = new RelativeLayout(this);
    swipeBackLayout = new SwipeBackLayout(this);
    swipeBackLayout.setOnSwipeBackListener(this);
    ivShadow = new ImageView(this);
    ivShadow.setBackgroundColor(getResources().getColor(R.color.abc_theme_black_7f));
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    container.addView(ivShadow, params);
    container.addView(swipeBackLayout);
    return container;
}
 
源代码5 项目: Mi-Band   文件: ColorPickerDialog.java
public ColorPickerDialog(Context context, int initialColor, final OnColorSelectedListener onColorSelectedListener) {
    super(context);

    RelativeLayout relativeLayout = new RelativeLayout(context);
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    colorPickerView = new ColorPicker(context);
    colorPickerView.setColor(initialColor);

    relativeLayout.addView(colorPickerView, layoutParams);

    OnClickListener onClickListener = new OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            switch (which) {
                case BUTTON_POSITIVE:
                    int selectedColor = colorPickerView.getColor();
                    onColorSelectedListener.onColorSelected(selectedColor);
                    break;
                case BUTTON_NEGATIVE:
                    dialog.dismiss();
                    break;
            }
        }

    };
    setButton(BUTTON_POSITIVE, context.getString(android.R.string.ok), onClickListener);
    setButton(BUTTON_NEGATIVE, context.getString(android.R.string.cancel), onClickListener);

    setView(relativeLayout);

}
 
源代码6 项目: redalert-android   文件: ColorPickerDialog.java
public ColorPickerDialog(Context context, int initialColor, final OnColorSelectedListener onColorSelectedListener) {
    super(context);

    RelativeLayout relativeLayout = new RelativeLayout(context);
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    colorPickerView = new ColorPicker(context);
    colorPickerView.setColor(initialColor);

    relativeLayout.addView(colorPickerView, layoutParams);

    OnClickListener onClickListener = new OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            switch (which) {
                case BUTTON_POSITIVE:
                    int selectedColor = colorPickerView.getColor();
                    onColorSelectedListener.onColorSelected(selectedColor);
                    break;
                case BUTTON_NEGATIVE:
                    dialog.dismiss();
                    break;
            }
        }

    };
    setButton(BUTTON_POSITIVE, context.getString(android.R.string.ok), onClickListener);
    setButton(BUTTON_NEGATIVE, context.getString(android.R.string.cancel), onClickListener);

    setView(relativeLayout);

}
 
源代码7 项目: DoubleViewPager   文件: VerticalPagerAdapter.java
@Override
public Object instantiateItem(ViewGroup container, int position) {

    LinearLayout linear = new LinearLayout(mContext);
    linear.setOrientation(LinearLayout.VERTICAL);
    linear.setGravity(Gravity.CENTER);
    LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    linear.setLayoutParams(lp);

    TextView tvParent = new TextView(mContext);
    tvParent.setGravity(Gravity.CENTER_HORIZONTAL);
    tvParent.setText("Parent:" + mParent);
    tvParent.setTextColor(Color.BLACK);
    tvParent.setTextSize(70);
    linear.addView(tvParent);

    TextView tvChild = new TextView(mContext);
    tvChild.setGravity(Gravity.CENTER_HORIZONTAL);
    tvChild.setText("Child:" + position);
    tvChild.setTextColor(Color.BLACK);
    tvChild.setTextSize(70);
    linear.addView(tvChild);

    setColors(position, linear);
    container.addView(linear);
    return linear;
}
 
源代码8 项目: geoar-app   文件: IntroController.java
private static void initPopupShow() {
	introViewer = new IntroViewer(activity, activity.getResources()
			.getString(R.string.intro_start_title), activity.getResources()
			.getString(R.string.intro_start_desc));

	graph = new TaskGraph();

	popup = new PopupWindow(introViewer, LayoutParams.MATCH_PARENT,
			LayoutParams.MATCH_PARENT);
	popup.setTouchable(false);
	popup.setFocusable(true);
	popup.setOutsideTouchable(true);
	popup.setTouchInterceptor(new OnTouchListener() {

		@Override
		public boolean onTouch(View v, MotionEvent event) {
			return false;
		}

	});

	activity.getWindow().getDecorView().post(new Runnable() {
		@Override
		public void run() {
			if(popup!=null)
			popup.showAtLocation(activity.getWindow().getDecorView()
					.getRootView(), Gravity.TOP, 0, 0);
		}
	});
}
 
源代码9 项目: SwipeBack   文件: SwipeBackActivity.java
private View getContainer() {
    RelativeLayout container = new RelativeLayout(this);
    swipeBackLayout = new SwipeBackLayout(this);
    swipeBackLayout.setDragEdge(DEFAULT_DRAG_EDGE);
    swipeBackLayout.setOnSwipeBackListener(this);
    ivShadow = new ImageView(this);
    ivShadow.setBackgroundColor(getResources().getColor(R.color.black_p50));
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    container.addView(ivShadow, params);
    container.addView(swipeBackLayout);
    return container;
}
 
源代码10 项目: xpra-client   文件: AndroidXpraWindow.java
private LayoutParams buildFullscreenParams(final NewWindow wndPacket) {
	final LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	return params;
}
 
源代码11 项目: android-sliding-layer-lib   文件: MainActivity.java
private void setupSlidingLayerPosition(String layerPosition) {

        LayoutParams rlp = (LayoutParams) mSlidingLayer.getLayoutParams();
        int textResource;
        Drawable d;

        switch (layerPosition) {
        case "right":
            textResource = R.string.swipe_right_label;
            d = getResources().getDrawable(R.drawable.container_rocket_right);

            mSlidingLayer.setStickTo(SlidingLayer.STICK_TO_RIGHT);
            break;
        case "left":
            textResource = R.string.swipe_left_label;
            d = getResources().getDrawable(R.drawable.container_rocket_left);

            mSlidingLayer.setStickTo(SlidingLayer.STICK_TO_LEFT);
            break;
        case "top":
            textResource = R.string.swipe_up_label;
            d = getResources().getDrawable(R.drawable.container_rocket);

            mSlidingLayer.setStickTo(SlidingLayer.STICK_TO_TOP);
            rlp.width = LayoutParams.MATCH_PARENT;
            rlp.height = getResources().getDimensionPixelSize(R.dimen.layer_size);
            break;
        default:
            textResource = R.string.swipe_down_label;
            d = getResources().getDrawable(R.drawable.container_rocket);

            mSlidingLayer.setStickTo(SlidingLayer.STICK_TO_BOTTOM);
            rlp.width = LayoutParams.MATCH_PARENT;
            rlp.height = getResources().getDimensionPixelSize(R.dimen.layer_size);
        }

        d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
        swipeText.setCompoundDrawables(null, d, null, null);
        swipeText.setText(getResources().getString(textResource));
        mSlidingLayer.setLayoutParams(rlp);
    }
 
源代码12 项目: Android-Color-Picker   文件: ColorPickerDialog.java
public ColorPickerDialog(Context context, int initialColor, OnColorSelectedListener onColorSelectedListener) {
    super(context);

    this.onColorSelectedListener = onColorSelectedListener;

    RelativeLayout relativeLayout = new RelativeLayout(context);
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    colorPickerView = new ColorPicker(context);
    colorPickerView.setColor(initialColor);

    relativeLayout.addView(colorPickerView, layoutParams);

    setButton(BUTTON_POSITIVE, context.getString(android.R.string.ok), onClickListener);
    setButton(BUTTON_NEGATIVE, context.getString(android.R.string.cancel), onClickListener);

    setView(relativeLayout);

}
 
@Override
protected View onCreateDialogView() {

    RelativeLayout relativeLayout = new RelativeLayout(getContext());
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

    colorPickerView = new ColorPicker(getContext());
    colorPickerView.setId(1);

    relativeLayout.addView(colorPickerView, layoutParams);

    return relativeLayout;

}