本文整理匯總了Java中android.widget.FrameLayout.LayoutParams.MATCH_PARENT屬性的典型用法代碼示例。如果您正苦於以下問題:Java LayoutParams.MATCH_PARENT屬性的具體用法?Java LayoutParams.MATCH_PARENT怎麽用?Java LayoutParams.MATCH_PARENT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.widget.FrameLayout.LayoutParams
的用法示例。
在下文中一共展示了LayoutParams.MATCH_PARENT屬性的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addChildView
/**
* Inflates the child view of a tab and adds it to the view hierarchy.
*
* @param tabItem
* The tab item, which corresponds to the tab, whose child view should be inflated, as
* an instance of the class {@link TabItem}. The tab item may not be null
*/
private void addChildView(@NonNull final TabItem tabItem) {
PhoneTabViewHolder viewHolder = tabItem.getViewHolder();
View view = viewHolder.child;
Tab tab = tabItem.getTab();
if (view == null) {
ViewGroup parent = viewHolder.childContainer;
Pair<View, ?> pair = childViewRecycler.inflate(tab, parent);
view = pair.first;
LayoutParams layoutParams =
new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
layoutParams.setMargins(model.getPaddingLeft(), model.getPaddingTop(),
model.getPaddingRight(), model.getPaddingBottom());
parent.addView(view, 0, layoutParams);
viewHolder.child = view;
} else {
childViewRecycler.getAdapter().onShowView(model.getContext(), view, tab, false);
}
viewHolder.previewImageView.setVisibility(View.GONE);
viewHolder.previewImageView.setImageBitmap(null);
viewHolder.borderView.setVisibility(View.GONE);
}
示例2: onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web);
ButterKnife.bind(this);
initializeToolbar();
mWebView = new WebView(this);
LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
mWebView.setLayoutParams(lp);
mContainer.addView(mWebView, 0);
if (Colorful.getThemeDelegate().isNight()) {
mContainer.setAlpha(0.7f);
}
if (getSupportActionBar() != null)
getSupportActionBar().setTitle(getIntent().getStringExtra("title"));
initWebView(getIntent().getStringExtra("url"));
}
示例3: BasicNativePage
public BasicNativePage(Activity activity, Tab tab) {
initialize(activity, tab);
mActivity = activity;
mTab = tab;
mBackgroundColor = ApiCompatibilityUtils.getColor(activity.getResources(),
R.color.default_primary_color);
mThemeColor = ApiCompatibilityUtils.getColor(
activity.getResources(), R.color.default_primary_color);
Resources res = mActivity.getResources();
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT);
layoutParams.setMargins(0,
res.getDimensionPixelSize(R.dimen.tab_strip_height)
+ res.getDimensionPixelSize(R.dimen.toolbar_height_no_shadow),
0, 0);
getView().setLayoutParams(layoutParams);
}
示例4: addContentView
/**
* Inflates the view, which is associated with a tab, and adds it to the view hierarchy.
*
* @param tabItem
* The tab item, which corresponds to the tab, whose associated view should be inflated,
* as an instance of the class {@link TabItem}. The tab item may not be null
*/
private void addContentView(@NonNull final TabItem tabItem) {
PhoneTabViewHolder viewHolder = (PhoneTabViewHolder) tabItem.getViewHolder();
View view = viewHolder.content;
Tab tab = tabItem.getTab();
if (view == null) {
ViewGroup parent = viewHolder.contentContainer;
Pair<View, ?> pair = tabViewRecycler.inflate(tab, parent);
view = pair.first;
LayoutParams layoutParams =
new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
Rect padding = getPadding();
layoutParams.setMargins(padding.left, padding.top, padding.right, padding.bottom);
parent.addView(view, 0, layoutParams);
viewHolder.content = view;
} else {
tabViewRecycler.getAdapter().onShowView(getModel().getContext(), view, tab, false);
}
viewHolder.previewImageView.setVisibility(View.GONE);
viewHolder.previewImageView.setImageBitmap(null);
viewHolder.borderView.setVisibility(View.GONE);
}
示例5: onShowTabView
@Override
protected final void onShowTabView(@NonNull final View view, @NonNull final TabItem tabItem,
@NonNull final Integer... params) {
LayoutParams layoutParams =
new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
int borderMargin = -(tabInset + tabBorderWidth);
int bottomMargin = params.length > 0 && params[0] != -1 ? params[0] : borderMargin;
layoutParams.leftMargin = borderMargin;
layoutParams.topMargin = -(tabInset + tabTitleContainerHeight);
layoutParams.rightMargin = borderMargin;
layoutParams.bottomMargin = bottomMargin;
view.setLayoutParams(layoutParams);
adaptContentBackgroundColor(tabItem);
adaptBackgroundVisibility(tabItem);
if (!getModel().isSwitcherShown()) {
addContentView(tabItem);
} else {
renderPreview(tabItem);
}
}
示例6: setupStatusBarView
private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {
mStatusBarTintView = new View(context);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight());
params.gravity = Gravity.TOP;
if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {
params.rightMargin = mConfig.getNavigationBarWidth();
}
mStatusBarTintView.setLayoutParams(params);
mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
mStatusBarTintView.setVisibility(View.GONE);
decorViewGroup.addView(mStatusBarTintView);
}
示例7: setupStatusBarView
private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {
mStatusBarTintView = new View(context);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight());
params.gravity = Gravity.TOP;
if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {
params.rightMargin = mConfig.getNavigationBarWidth();
}
mStatusBarTintView.setLayoutParams(params);
mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
mStatusBarTintView.setVisibility(View.GONE);
decorViewGroup.addView(mStatusBarTintView);
}
示例8: setFullscreenManager
/**
* @param manager The fullscreen manager that should be notified of changes to this tab (if
* set to null, no more updates will come from this tab).
*/
public void setFullscreenManager(FullscreenManager manager) {
mFullscreenManager = manager;
if (mFullscreenManager != null) {
boolean topOffsetsInitialized = !Float.isNaN(mPreviousTopControlsOffsetY)
&& !Float.isNaN(mPreviousContentOffsetY);
boolean bottomOffsetsInitialized =
!Float.isNaN(mPreviousBottomControlsOffsetY);
boolean isChromeHomeEnabled = FeatureUtilities.isChromeHomeEnabled();
// Make sure the dominant control offsets have been set.
if ((!topOffsetsInitialized && !isChromeHomeEnabled)
|| (!bottomOffsetsInitialized && isChromeHomeEnabled)) {
mFullscreenManager.setPositionsForTabToNonFullscreen();
} else {
mFullscreenManager.setPositionsForTab(mPreviousTopControlsOffsetY,
mPreviousBottomControlsOffsetY,
mPreviousContentOffsetY);
}
updateFullscreenEnabledState();
}
// For blimp mode, offset the blimp view by the height of browser controls. This will ensure
// that the view doesn't get clipped at the bottom of the page and also the touch offsets
// would work correctly.
if (getBlimpContents() != null && mFullscreenManager != null) {
ViewGroup blimpView = getBlimpContents().getView();
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) blimpView.getLayoutParams();
if (lp == null) {
lp = new FrameLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
}
lp.topMargin = mFullscreenManager.getTopControlsHeight();
blimpView.setLayoutParams(lp);
}
}
示例9: onShowView
@Override
public final void onShowView(@NonNull final Context context, @NonNull final View view,
@NonNull final TabItem tabItem, final boolean inflated,
@NonNull final Integer... params) {
PhoneTabViewHolder viewHolder = (PhoneTabViewHolder) view.getTag(R.id.tag_view_holder);
if (!tabItem.isInflated()) {
tabItem.setView(view);
tabItem.setViewHolder(viewHolder);
view.setTag(R.id.tag_properties, tabItem.getTag());
}
LayoutParams layoutParams =
new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
int borderMargin = -(tabInset + tabBorderWidth);
int bottomMargin = params.length > 0 && params[0] != -1 ? params[0] : borderMargin;
layoutParams.leftMargin = borderMargin;
layoutParams.topMargin = -(tabInset + tabTitleContainerHeight);
layoutParams.rightMargin = borderMargin;
layoutParams.bottomMargin = bottomMargin;
view.setLayoutParams(layoutParams);
Tab tab = tabItem.getTab();
tab.addCallback(this);
adaptTitle(viewHolder, tab);
adaptIcon(viewHolder, tab);
adaptCloseButton(viewHolder, tab);
adaptCloseButtonIcon(viewHolder, tab);
adaptBackgroundColor(view, viewHolder, tab);
adaptTitleTextColor(viewHolder, tab);
adaptSelectionState(viewHolder, tab);
if (!model.isSwitcherShown()) {
if (tab == model.getSelectedTab()) {
addChildView(tabItem);
}
} else {
renderChildView(tabItem);
}
}