Java Code Examples for android.view.View#setMinimumWidth()
The following examples show how to use
android.view.View#setMinimumWidth() .
These examples are extracted from open source projects.
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 Project: an2linuxclient File: ServerDialog.java License: GNU General Public License v3.0 | 6 votes |
void initViews(View v) { getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE); getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); Rect displayRectangle = new Rect(); Window window = getActivity().getWindow(); window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle); v.setMinimumWidth((int)(displayRectangle.width() * 0.9f)); pairingInfoTextView = (TextView) v.findViewById(R.id.pairingInfoTextView); initiatePairingButton = (Button) v.findViewById(R.id.initiatePairingButton); saveServerBtn = (Button) v.findViewById(R.id.saveServerBtn); v.findViewById(R.id.cancelBtn).setOnClickListener(view -> cancel()); }
Example 2
Source Project: FimiX8-RE File: AbViewUtil.java License: MIT License | 5 votes |
@SuppressLint({"NewApi"}) public static void scaleView(View view) { if (view instanceof TextView) { TextView textView = (TextView) view; setTextSize(textView, textView.getTextSize()); } LayoutParams params = view.getLayoutParams(); if (params != null) { int width = Integer.MIN_VALUE; int height = Integer.MIN_VALUE; if (!(params.width == -2 || params.width == -1)) { width = params.width; } if (!(params.height == -2 || params.height == -1)) { height = params.height; } setViewSize(view, width, height); setPadding(view, view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom()); } if (view.getLayoutParams() instanceof MarginLayoutParams) { MarginLayoutParams mMarginLayoutParams = (MarginLayoutParams) view.getLayoutParams(); if (mMarginLayoutParams != null) { setMargin(view, mMarginLayoutParams.leftMargin, mMarginLayoutParams.topMargin, mMarginLayoutParams.rightMargin, mMarginLayoutParams.bottomMargin); } } if (VERSION.SDK_INT >= 16) { int minWidth = scaleValue(view.getContext(), (float) view.getMinimumWidth()); int minHeight = scaleValue(view.getContext(), (float) view.getMinimumHeight()); view.setMinimumWidth(minWidth); view.setMinimumHeight(minHeight); } }
Example 3
Source Project: Elephant File: VoteDialog.java License: Apache License 2.0 | 5 votes |
private void initContentView() { View view = LayoutInflater.from(mContext).inflate(R.layout.dialog_vote, null); Rect displayRectangle = new Rect(); Window window = getWindow(); window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle); view.setMinimumWidth((int) (displayRectangle.width() * 0.8f)); window.setBackgroundDrawableResource(R.color.dialog_bg); setContentView(view); }
Example 4
Source Project: DevUtils File: ViewUtils.java License: Apache License 2.0 | 5 votes |
/** * 设置 View 最小宽度 * @param view {@link View} * @param minWidth 最小宽度 * @return {@link View} */ public static View setMinimumWidth(final View view, final int minWidth) { if (view != null) { view.setMinimumWidth(minWidth); } return view; }
Example 5
Source Project: ImitateTaobaoApp File: FragmentTabHost.java License: Apache License 2.0 | 5 votes |
@Override public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; }
Example 6
Source Project: android_tv_metro File: MainActivity.java License: Apache License 2.0 | 5 votes |
@Override public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; }
Example 7
Source Project: CodenameOne File: FragmentTabHost.java License: GNU General Public License v2.0 | 5 votes |
@Override public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; }
Example 8
Source Project: AutoLayout-Android File: MinWidthAttr.java License: Apache License 2.0 | 5 votes |
@Override protected void execute(View view, int val) { view.setMinimumWidth(val); if (view instanceof TextView) { ((TextView) view).setMinWidth(val); } else if (view instanceof ProgressBar) { try { Field field = view.getClass().getDeclaredField("mMinWidth"); field.setAccessible(true); field.set(view, val); } catch (Exception e) { } } }
Example 9
Source Project: Android-tv-widget File: OpenTabHost.java License: Apache License 2.0 | 5 votes |
/** * 创建一个空的Content. */ @Override public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; }
Example 10
Source Project: TokenAutoComplete File: ViewSpanTest.java License: Apache License 2.0 | 5 votes |
@Test public void correctLineHeightWithoutBaseline() { View view = new View(context); view.setMinimumHeight(1000); view.setMinimumWidth(1000); ViewSpan span = new ViewSpan(view, layout); Paint paint = new Paint(); Paint.FontMetricsInt fontMetricsInt = paint.getFontMetricsInt(); int width = span.getSize(paint, "", 0, 0, fontMetricsInt); assertEquals(100, width); assertEquals(0, fontMetricsInt.bottom); assertEquals(-view.getHeight(), fontMetricsInt.top); }
Example 11
Source Project: Matisse File: SizeUtils.java License: Apache License 2.0 | 5 votes |
@SuppressLint({"NewApi"}) public static void scaleView(View view) { if ((view instanceof TextView)) { TextView textView = (TextView) view; setTextSize(textView, textView.getTextSize()); } ViewGroup.LayoutParams params = view.getLayoutParams(); if (null != params) { int width = -2147483648; int height = -2147483648; if ((params.width != -2) && (params.width != -1)) { width = params.width; } if ((params.height != -2) && (params.height != -1)) { height = params.height; } setViewSize(view, width, height); setPadding(view, view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom()); } if ((view.getLayoutParams() instanceof ViewGroup.MarginLayoutParams)) { ViewGroup.MarginLayoutParams mMarginLayoutParams = (ViewGroup.MarginLayoutParams) view .getLayoutParams(); if (mMarginLayoutParams != null) { setMargin(view, mMarginLayoutParams.leftMargin, mMarginLayoutParams.topMargin, mMarginLayoutParams.rightMargin, mMarginLayoutParams.bottomMargin); } } if (Build.VERSION.SDK_INT >= 16) { int minWidth = scaleValue(view.getContext(), view.getMinimumWidth()); int minHeight = scaleValue(view.getContext(), view.getMinimumHeight()); view.setMinimumWidth(minWidth); view.setMinimumHeight(minHeight); } }
Example 12
Source Project: enjoyshop File: FragmentTabHost.java License: Apache License 2.0 | 5 votes |
@Override public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; }
Example 13
Source Project: RobotCA File: HelpFragment.java License: GNU General Public License v3.0 | 5 votes |
public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; }
Example 14
Source Project: V.FlyoutTest File: FragmentTabHost.java License: MIT License | 5 votes |
@Override public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; }
Example 15
Source Project: AndroidBase File: FragmentTabHost.java License: Apache License 2.0 | 5 votes |
@Override public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; }
Example 16
Source Project: FragmentMixViewPager File: BaseFragmentTabHost.java License: Apache License 2.0 | 5 votes |
@Override public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; }
Example 17
Source Project: AndroidAutoLayout File: MinWidthAttr.java License: Apache License 2.0 | 5 votes |
@Override protected void execute(View view, int val) { try { // Method setMaxWidthMethod = view.getClass().getMethod("setMinWidth", int.class); // setMaxWidthMethod.invoke(view, val); } catch (Exception ignore) { } view.setMinimumWidth(val); }
Example 18
Source Project: GPS2SMS File: SlideTabsFactory.java License: GNU General Public License v3.0 | 4 votes |
public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; }
Example 19
Source Project: letv File: FragmentTabHost.java License: Apache License 2.0 | 4 votes |
public View createTabContent(String tag) { View v = new View(this.mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; }
Example 20
Source Project: callerid-for-android File: TabsAdapter.java License: GNU General Public License v3.0 | 4 votes |
public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; }