Java Code Examples for android.widget.RelativeLayout.LayoutParams#MATCH_PARENT
The following examples show how to use
android.widget.RelativeLayout.LayoutParams#MATCH_PARENT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InfoAdapter.java From douyin with Apache License 2.0 | 6 votes |
@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; }
Example 2
Source File: BrowserDelegate.java From CoreModule with Apache License 2.0 | 6 votes |
@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(); }
Example 3
Source File: NodeInflater.java From financisto with GNU General Public License v2.0 | 5 votes |
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); }
Example 4
Source File: AbsBaseSwipeBackActivity.java From LLApp with Apache License 2.0 | 5 votes |
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; }
Example 5
Source File: ColorPickerDialog.java From Mi-Band with GNU General Public License v2.0 | 5 votes |
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); }
Example 6
Source File: ColorPickerDialog.java From redalert-android with Apache License 2.0 | 5 votes |
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); }
Example 7
Source File: VerticalPagerAdapter.java From DoubleViewPager with Apache License 2.0 | 5 votes |
@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; }
Example 8
Source File: IntroController.java From geoar-app with Apache License 2.0 | 5 votes |
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); } }); }
Example 9
Source File: SwipeBackActivity.java From SwipeBack with Apache License 2.0 | 5 votes |
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; }
Example 10
Source File: AndroidXpraWindow.java From xpra-client with GNU General Public License v3.0 | 4 votes |
private LayoutParams buildFullscreenParams(final NewWindow wndPacket) { final LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); return params; }
Example 11
Source File: MainActivity.java From android-sliding-layer-lib with Apache License 2.0 | 4 votes |
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); }
Example 12
Source File: ColorPickerDialog.java From Android-Color-Picker with Apache License 2.0 | 4 votes |
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); }
Example 13
Source File: ColorPickerPreference.java From Android-Color-Picker with Apache License 2.0 | 3 votes |
@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; }