Java Code Examples for android.view.View.setMinimumWidth()

The following are Jave code examples for showing how to use setMinimumWidth() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: EsperantoRadio   File: PagerSlidingTabStrip.java   View Source Code Vote up 7 votes
private void addTab(final int position, View tab) {
  tab.setFocusable(true);
  tab.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      pager.setCurrentItem(position);
      // XXX INDSAT TIL DR RADIO: “Nulstil” visning, når der tappes på kanalikon i toppen, så man kommer tilbage til NU-visning (belejligt hvis man har scrollet op el. ned i epg liste)
      //if (delegatePageListener != null && delegatePageListener instanceof Kanaler_frag) {
      //  ((Kanaler_frag) delegatePageListener).klikPåFane(position);
      //}
      // Grimt hack, men desværre umuligt at gøre på en anden måde
      if (Kanal_frag.senesteSynligeFragment != null) {
        Kanal_frag.senesteSynligeFragment.rulBlødtTilAktuelUdsendelse();
      }
      // XXX INDSAT TIL DR RADIO slut
    }
  });

  tab.setPadding(tabPadding, 0, tabPadding, 0);
  tab.setMinimumWidth(minBredde);
  tabsContainer.addView(tab, position, shouldExpand ? expandedTabLayoutParams : defaultTabLayoutParams);
}
 
Example 2
Project: fuckView   File: Hook.java   View Source Code Vote up 6 votes
private static void fuckView(View v, boolean shouldVisibility) {

            if (shouldVisibility)
                v.setVisibility(View.GONE);
            v.setWillNotDraw(true);
            ViewGroup.LayoutParams layoutParams = v.getLayoutParams();
            layoutParams.height = 0;
            layoutParams.width = 0;
            v.setPadding(0, 0, 0, 0);
            v.setMinimumHeight(0);
            v.setMinimumWidth(0);

            v.setBackgroundColor(Color.TRANSPARENT);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                v.setAlpha(0f);
            }

            v.setLayoutParams(layoutParams);
            v.clearAnimation();
        }
 
Example 3
Project: an2linuxclient   File: ServerDialog.java   View Source Code Vote up 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(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            cancel();
        }
    });
}
 
Example 4
Project: GitHub   File: DynamicHelper.java   View Source Code Vote up 5 votes
/**
 * apply minimum Width in view
 */
public static void applyMinWidth(View view, DynamicProperty property) {
    if (view != null) {
        if (property.type == DynamicProperty.TYPE.DIMEN) {
            view.setMinimumWidth(property.getValueInt());
        }
    }
}
 
Example 5
Project: GitHub   File: FragmentTabHost.java   View Source Code Vote up 5 votes
@Override
public View createTabContent(String tag) {
    View v = new View(mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 6
Project: cniao5   File: FragmentTabHost.java   View Source Code Vote up 5 votes
@Override
public View createTabContent(String tag) {
    View v = new View(mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 7
Project: mobile-store   File: TabsAdapter.java   View Source Code Vote up 5 votes
@Override
public View createTabContent(String tag) {
    View v = new View(context);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 8
Project: LuaViewPlayground   File: UDView.java   View Source Code Vote up 5 votes
/**
 * 获取宽度
 *
 * @param width
 * @return
 */
public UDView setMinWidth(int width) {
    if (width >= 0) {
        final View view = getView();
        if (view != null) {
            view.setMinimumWidth(width);
        }
    }
    return this;
}
 
Example 9
Project: chromium-for-android-56-debug-video   File: PasswordGenerationAdapter.java   View Source Code Vote up 5 votes
/**
 * Builds the adapter to display views using data from delegate.
 * @param context Android context.
 * @param delegate The handler for clicking on the "saved passwords" link.
 * @param passwordDisplayed Whether the auto-generated password should be suggested.
 * @param password The auto-generated password to suggest.
 * @param suggestionTitle The translated title of the suggestion part of the UI.
 * @param explanationText The translated text for the explanation part of the UI.
 * @param explanationTextLinkRangeStart The start of the range in the explanation text that
 * should be a link to the saved passwords.
 * @param explanationTextLinkRangeEnd The end of the range in the explanation text that should
 * be a link to the saved passwords.
 * @param anchorWidthInDp The width of the anchor to which the popup is attached. Used to size
 * the explanation view.
 */
public PasswordGenerationAdapter(Context context, Delegate delegate, boolean passwordDisplayed,
        String password, String suggestionTitle, String explanationText,
        int explanationTextLinkRangeStart, int explanationTextLinkRangeEnd,
        float anchorWidthInDp) {
    super();
    mContext = context;
    mDelegate = delegate;
    mViewTypes = passwordDisplayed ? Arrays.asList(SUGGESTION, EXPLANATION)
            : Arrays.asList(EXPLANATION);
    mPassword = password;
    mSuggestionTitle = suggestionTitle;
    mExplanationText = explanationText;
    mExplanationTextLinkRangeStart = explanationTextLinkRangeStart;
    mExplanationTextLinkRangeEnd = explanationTextLinkRangeEnd;

    int horizontalMarginInPx = Math.round(mContext.getResources().getDimension(
            R.dimen.password_generation_horizontal_margin));
    int anchorWidthInPx = Math.round(anchorWidthInDp
            * mContext.getResources().getDisplayMetrics().density);
    View suggestion = getViewForType(SUGGESTION).findViewById(
            R.id.password_generation_suggestion);
    suggestion.setMinimumWidth(anchorWidthInPx - 2 * horizontalMarginInPx);
    suggestion.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
            MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
    mSuggestionMeasuredWidth = suggestion.getMeasuredWidth();
}
 
Example 10
Project: cwac-crossport   File: TabLayoutLite.java   View Source Code Vote up 5 votes
void updateTabViews(final boolean requestLayout) {
  for (int i = 0; i < mTabStrip.getChildCount(); i++) {
    View child = mTabStrip.getChildAt(i);
    child.setMinimumWidth(getTabMinWidth());
    updateTabViewLayoutParams((LinearLayout.LayoutParams) child.getLayoutParams());
    if (requestLayout) {
      child.requestLayout();
    }
  }
}
 
Example 11
Project: cwac-crossport   File: TabLayout.java   View Source Code Vote up 5 votes
void updateTabViews(final boolean requestLayout) {
  for (int i = 0; i < mTabStrip.getChildCount(); i++) {
    View child = mTabStrip.getChildAt(i);
    child.setMinimumWidth(getTabMinWidth());
    updateTabViewLayoutParams((LinearLayout.LayoutParams) child.getLayoutParams());
    if (requestLayout) {
      child.requestLayout();
    }
  }
}
 
Example 12
Project: GongXianSheng   File: FragmentTabHost.java   View Source Code Vote up 5 votes
@Override
public View createTabContent(String tag) {
    View v = new View(mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 13
Project: boohee_v5.6   File: TabLayout.java   View Source Code Vote up 5 votes
private void updateTabViews(boolean requestLayout) {
    for (int i = 0; i < this.mTabStrip.getChildCount(); i++) {
        View child = this.mTabStrip.getChildAt(i);
        child.setMinimumWidth(getTabMinWidth());
        updateTabViewLayoutParams((LayoutParams) child.getLayoutParams());
        if (requestLayout) {
            child.requestLayout();
        }
    }
}
 
Example 14
Project: zabbkit-android   File: FixedFragmentTabHost.java   View Source Code Vote up 5 votes
@Override
public View createTabContent(final String tag) {
	View v = new View(mContext);
	v.setMinimumWidth(0);
	v.setMinimumHeight(0);
	return v;
}
 
Example 15
Project: aos-MediaLib   File: InfoDialog.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.archos_info_dialog);
    setCancelable(true);
    setCanceledOnTouchOutside(true);

    View root = findViewById(R.id.dialog_root_layout);
    if (mMinWidth!=0) {
    	root.setMinimumWidth(mMinWidth);
    }
    if (mMinHeight!=0) {
    	root.setMinimumHeight(mMinHeight);
    }

    mTitleView = (TextView) findViewById(R.id.archos_info_title);
    if (mTitle != null) {
        mTitleView.setText(mTitle);
    }
    mSubtitleView = (TextView) findViewById(R.id.archos_info_subtitle);
    if (mSubtitle != null) {
        mSubtitleView.setText(mSubtitle);
    }
    mIconView = (ImageView) findViewById(R.id.archos_info_icon);
    if (mIconDrawable != null) {
        mIconView.setImageDrawable(mIconDrawable);
        setIconSize(mIconDrawable);
    } else if (mIconResId != 0) {
        mIconView.setImageResource(mIconResId);
        setIconSize(mIconResId);
    }

    // Display file info if already available
    if (mFileSelection != null) {
        updateFileSelectionInfo();
    }
}
 
Example 16
Project: YCWeather   File: ViewUtil.java   View Source Code Vote up 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 = (ViewGroup.LayoutParams) view.getLayoutParams();
    if (null != params) {
        int width = INVALID;
        int height = INVALID;
        if (params.width != ViewGroup.LayoutParams.WRAP_CONTENT
                && params.width != ViewGroup.LayoutParams.MATCH_PARENT) {
            width = params.width;
        }
        if (params.height != ViewGroup.LayoutParams.WRAP_CONTENT
                && params.height != ViewGroup.LayoutParams.MATCH_PARENT) {
            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(), view.getMinimumWidth());
        int minHeight = scaleValue(view.getContext(), view.getMinimumHeight());
        view.setMinimumWidth(minWidth);
        view.setMinimumHeight(minHeight);
    }
}
 
Example 17
Project: letv   File: FragmentTabHost.java   View Source Code Vote up 4 votes
public View createTabContent(String tag) {
    View v = new View(this.mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 18
Project: MyFlightbookAndroid   File: MFBMain.java   View Source Code Vote up 4 votes
public View createTabContent(String tag) {
    View v = new View(mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 19
Project: boohee_v5.6   File: FragmentTabHost.java   View Source Code Vote up 4 votes
public View createTabContent(String tag) {
    View v = new View(this.mContext);
    v.setMinimumWidth(0);
    v.setMinimumHeight(0);
    return v;
}
 
Example 20
Project: RLibrary   File: UITitleBarContainer.java   View Source Code Vote up 4 votes
/**
     * 填充左右控制按钮
     */
    private void fillViews(LinearLayout layout, ArrayList<TitleBarPattern.TitleBarItem> items, ArrayList<View> views) {
        if (items == null || items.isEmpty()) {
            return;
        }

        int itemSize = getResources().getDimensionPixelSize(R.dimen.base_title_bar_item_size);

        for (int i = 0; i < items.size(); i++) {
            final TitleBarPattern.TitleBarItem item = items.get(i);
            View view;
            if (item.icoDrawable == null) {
                //不是图片, 就创建文本按钮
                view = createTextItem(item.text, item.textColor);
                if (item.textSize != -1) {
                    ((TextView) view).setTextSize(TypedValue.COMPLEX_UNIT_PX, item.textSize);
                }
            } else {
                //创建图片按钮
                view = createImageItem(item.icoDrawable);
                view.setMinimumWidth(itemSize);
            }

            ViewExKt.setOnRClickListener(view, item.listener);
            view.setBackgroundResource(R.drawable.base_bg2_selector_v21);

            view.setVisibility(item.visibility);
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -1);
            layoutParams.setMargins(item.leftMargin, item.topMargin, item.rightMargin, item.bottomMargin);
            view.setTag(R.id.tag, i);//方便之后查找这个view
            layout.addView(view, layoutParams);
            views.add(view);

            if (item.mOnItemInitListener != null) {
                item.mOnItemInitListener.onItemInit(view, item);
            }
        }

//        for (TitleBarPattern.TitleBarItem item : items) {
//            View view;
//            if (item.res == -1) {
//                //不是图片, 就创建文本按钮
//                view = createTextItem(item.text, item.listener);
//            } else {
//                //创建图片按钮
//                view = createImageItem(item.res, item.listener);
//            }
//            layout.addView(view, new LinearLayout.LayoutParams(itemSize, -1));
//            views.add(view);
//        }
    }