本文整理汇总了Java中android.widget.FrameLayout.LayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java FrameLayout.LayoutParams方法的具体用法?Java FrameLayout.LayoutParams怎么用?Java FrameLayout.LayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.FrameLayout
的用法示例。
在下文中一共展示了FrameLayout.LayoutParams方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ControllerV16
import android.widget.FrameLayout; //导入方法依赖的package包/类
public ControllerV16(View header) {
Resources res = header.getContext().getResources();
mScrollToElevation = res.getDimension(R.dimen.all_apps_header_scroll_to_elevation);
mShadow = new View(header.getContext());
mShadow.setBackground(new GradientDrawable(
GradientDrawable.Orientation.TOP_BOTTOM, new int[] {0x1E000000, 0x00000000}));
mShadow.setAlpha(0);
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
res.getDimensionPixelSize(R.dimen.all_apps_header_shadow_height));
lp.topMargin = ((FrameLayout.LayoutParams) header.getLayoutParams()).height;
((ViewGroup) header.getParent()).addView(mShadow, lp);
}
示例2: openCaptionEnter
import android.widget.FrameLayout; //导入方法依赖的package包/类
private void openCaptionEnter() {
if (imageMoveAnimation != null || changeModeAnimation != null) {
return;
}
paintItem.setVisibility(View.GONE);
cropItem.setVisibility(View.GONE);
tuneItem.setVisibility(View.GONE);
checkImageView.setVisibility(View.GONE);
captionDoneItem.setVisibility(View.VISIBLE);
pickerView.setVisibility(View.GONE);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) captionEditText.getLayoutParams();
layoutParams.bottomMargin = 0;
captionEditText.setLayoutParams(layoutParams);
layoutParams = (FrameLayout.LayoutParams) mentionListView.getLayoutParams();
layoutParams.bottomMargin = 0;
mentionListView.setLayoutParams(layoutParams);
captionTextView.setVisibility(View.INVISIBLE);
captionEditText.openKeyboard();
lastTitle = actionBar.getTitle();
actionBar.setTitle(LocaleController.getString("PhotoCaption", R.string.PhotoCaption));
}
示例3: onAttachedToWindow
import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (isInEditMode() && previewLayoutId != -1) {
for (int i = NUMBER_OF_SIMULTANEOUS_CARDS - 1; i >= 0; i--) {
View view = LayoutInflater.from(getContext()).inflate(previewLayoutId, this, false);
FrameLayout.LayoutParams params = (LayoutParams) view.getLayoutParams();
int offset = (int) (i * CARD_SPACING);
// All cards are placed in absolute coordinates, so disable gravity if we have any
params.gravity = Gravity.NO_GRAVITY;
// We can't user translations here, for some reason it's not rendered properly in preview
params.topMargin = offset;
view.setLayoutParams(params);
addViewInLayout(view, -1, params, true);
}
setZTranslations();
}
}
示例4: Subtitle3DTextView
import android.widget.FrameLayout; //导入方法依赖的package包/类
public Subtitle3DTextView(Context context, AttributeSet attrs) {
super(context, attrs);
setPadding(0,0,0,0);
mAttrs = attrs;
mPrimaryTV = new SubtitleTextView(context, attrs);
mPrimaryTV.setVisibility(VISIBLE); //no matter what was in attrs (visibility is taken into account in parent layout, not in textview)
mPrimaryFrameLayout = new FrameLayout(context);
mSecondaryFrameLayout = new FrameLayout(context);
mSecondaryTV = new SubtitleTextView(context, attrs);
mSecondaryTV.setVisibility(VISIBLE); //no matter what was in attrs (visibility is taken into account in parent layout, not in textview)
addView(mPrimaryFrameLayout);
mSecondaryFrameLayout.addView(mSecondaryTV);
mPrimaryFrameLayout.addView(mPrimaryTV);
addView(mSecondaryFrameLayout);
mPrimaryFrameLayout.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
mSecondaryFrameLayout.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
((LayoutParams)mPrimaryFrameLayout.getLayoutParams()).weight = 1;
((LayoutParams)mSecondaryFrameLayout.getLayoutParams()).weight = 1;
((FrameLayout.LayoutParams)mSecondaryTV.getLayoutParams()).gravity = Gravity.BOTTOM;
((FrameLayout.LayoutParams)mPrimaryTV.getLayoutParams()).gravity = Gravity.BOTTOM;
((FrameLayout.LayoutParams)mSecondaryTV.getLayoutParams()).height = ViewGroup.LayoutParams.WRAP_CONTENT;
((FrameLayout.LayoutParams)mPrimaryTV.getLayoutParams()).height = ViewGroup.LayoutParams.WRAP_CONTENT;
}
示例5: onCreate
import android.widget.FrameLayout; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
protected final void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContentView = new VideoView(this);
mContentView.setVisibility(View.GONE);
mContentView.setOnPreparedListener(new OnPreparedListener());
final FrameLayout.LayoutParams layoutParams =
new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT,
Gravity.CENTER);
mContentView.setLayoutParams(layoutParams);
setContentView(mContentView);
startEncode(new File(getFilesDir(), OUTPUT_FILE_NAME).getAbsolutePath());
}
示例6: setShowState
import android.widget.FrameLayout; //导入方法依赖的package包/类
private void setShowState(boolean show) {
ObjectAnimator nextAnimator = null;
if (show && getVisibility() != View.VISIBLE && mCurrentAnimation != mAnimationEnter) {
View anchorView = getRootView().findViewById(R.id.toolbar);
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams();
lp.topMargin = anchorView.getBottom() - mYInsetPx;
setLayoutParams(lp);
nextAnimator = mAnimationEnter;
} else if (!show && getVisibility() != View.GONE && mCurrentAnimation != mAnimationLeave) {
nextAnimator = mAnimationLeave;
onHideAnimationStart();
}
if (nextAnimator != null) {
mCurrentAnimation = nextAnimator;
startAnimationOverContent(nextAnimator);
postInvalidateOnAnimation();
}
}
示例7: configureCard
import android.widget.FrameLayout; //导入方法依赖的package包/类
private void configureCard(ViewGroup card) {
cardContent.setMaxWidth(getCardWidth());
cardContent.setPadding(
CARD_PADDING_VERTICAL,
CARD_PADDING_HORIZONTAL,
CARD_PADDING_VERTICAL,
CARD_PADDING_HORIZONTAL
);
cardContent.setLayoutParams(new FrameLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT
));
card.setBackgroundResource(getCardBackgroundDrawable());
card.addView(cardContent);
FrameLayout.LayoutParams cardLayoutParams = generateDefaultLayoutParams();
cardLayoutParams.width = LayoutParams.WRAP_CONTENT;
cardLayoutParams.height = LayoutParams.WRAP_CONTENT;
cardLayoutParams.gravity = getCardGravity();
cardLayoutParams.leftMargin = getCardMarginLeft();
cardLayoutParams.topMargin = getCardMarginTop();
cardLayoutParams.rightMargin = getCardMarginRight();
cardLayoutParams.bottomMargin = getCardMarginBottom();
card.setLayoutParams(cardLayoutParams);
}
示例8: getView
import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
public View getView() {
FrameLayout root = new FrameLayout(mContext);
root.setBackgroundColor(Color.WHITE);
mWebView = new WebView(mContext);//mContext.getApplicationContext();
FrameLayout.LayoutParams wvLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT);
wvLayoutParams.gravity = Gravity.CENTER;
mWebView.setLayoutParams(wvLayoutParams);
root.addView(mWebView);
initWebView(mWebView);
mProgressBar = new ProgressBar(mContext);
showProgressBar(false);
FrameLayout.LayoutParams pLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);
mProgressBar.setLayoutParams(pLayoutParams);
pLayoutParams.gravity = Gravity.CENTER;
root.addView(mProgressBar);
return root;
}
示例9: ExoPlayerView
import android.widget.FrameLayout; //导入方法依赖的package包/类
public ExoPlayerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
boolean useTextureView = false;
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
componentListener = new ComponentListener();
FrameLayout.LayoutParams aspectRatioParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT);
aspectRatioParams.gravity = Gravity.CENTER;
layout = new AspectRatioFrameLayout(context);
layout.setLayoutParams(aspectRatioParams);
shutterView = new View(getContext());
shutterView.setLayoutParams(params);
shutterView.setBackgroundColor(ContextCompat.getColor(context, android.R.color.black));
subtitleLayout = new SubtitleView(context);
subtitleLayout.setLayoutParams(params);
subtitleLayout.setUserDefaultStyle();
subtitleLayout.setUserDefaultTextSize();
View view = useTextureView ? new TextureView(context) : new SurfaceView(context);
view.setLayoutParams(params);
surfaceView = view;
layout.addView(surfaceView, 0, params);
layout.addView(shutterView, 1, params);
layout.addView(subtitleLayout, 2, params);
addViewInLayout(layout, 0, aspectRatioParams);
}
示例10: QuickActionViewLayout
import android.widget.FrameLayout; //导入方法依赖的package包/类
public QuickActionViewLayout(Context context, ArrayList<Action> actions, Point centerPoint) {
super(context);
mCenterPoint = centerPoint;
mScrimView = new View(context);
mScrimView.setBackgroundColor(mScrimColor);
FrameLayout.LayoutParams scrimParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
addView(mScrimView, scrimParams);
mIndicatorView = new View(context);
if (Build.VERSION.SDK_INT >= 16) {
mIndicatorView.setBackground(mIndicatorDrawable);
} else {
mIndicatorView.setBackgroundDrawable(mIndicatorDrawable);
}
FrameLayout.LayoutParams indicatorParams = new FrameLayout.LayoutParams(mIndicatorDrawable.getIntrinsicWidth(), mIndicatorDrawable.getIntrinsicHeight());
addView(mIndicatorView, indicatorParams);
for (Action action : actions) {
ConfigHelper helper = new ConfigHelper(action.getConfig(), mConfig);
ActionView actionView = new ActionView(context, action, helper);
mActionViews.put(action, actionView);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
addView(actionView, params);
if (!TextUtils.isEmpty(action.getTitle())) {
ActionTitleView actionTitleView = new ActionTitleView(context, action, helper);
actionTitleView.setVisibility(View.GONE);
mActionTitleViews.put(action, actionTitleView);
FrameLayout.LayoutParams titleParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
addView(actionTitleView, titleParams);
}
}
}
示例11: startWindowFullscreen
import android.widget.FrameLayout; //导入方法依赖的package包/类
public void startWindowFullscreen() {
Log.i(TAG, "startWindowFullscreen " + " [" + this.hashCode() + "] ");
hideSupportActionBar(getContext());
JZUtils.setRequestedOrientation(getContext(), FULLSCREEN_ORIENTATION);
ViewGroup vp = (JZUtils.scanForActivity(getContext()))//.getWindow().getDecorView();
.findViewById(Window.ID_ANDROID_CONTENT);
View old = vp.findViewById(R.id.jz_fullscreen_id);
if (old != null) {
vp.removeView(old);
}
textureViewContainer.removeView(JZMediaManager.textureView);
try {
Constructor<JZVideoPlayer> constructor = (Constructor<JZVideoPlayer>) JZVideoPlayer.this.getClass().getConstructor(Context.class);
JZVideoPlayer jzVideoPlayer = constructor.newInstance(getContext());
jzVideoPlayer.setId(R.id.jz_fullscreen_id);
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
vp.addView(jzVideoPlayer, lp);
jzVideoPlayer.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_FULLSCREEN);
jzVideoPlayer.setUp(dataSourceObjects, currentUrlMapIndex, JZVideoPlayerStandard.SCREEN_WINDOW_FULLSCREEN, objects);
jzVideoPlayer.setState(currentState);
jzVideoPlayer.addTextureView();
JZVideoPlayerManager.setSecondFloor(jzVideoPlayer);
// final Animation ra = AnimationUtils.loadAnimation(getContext(), R.anim.start_fullscreen);
// jzVideoPlayer.setAnimation(ra);
onStateNormal();
jzVideoPlayer.progressBar.setSecondaryProgress(progressBar.getSecondaryProgress());
jzVideoPlayer.startProgressTimer();
CLICK_QUIT_FULLSCREEN_TIME = System.currentTimeMillis();
} catch (Exception e) {
e.printStackTrace();
}
}
示例12: addSubView
import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
protected void addSubView(View view, int index) {
if (view == null || mAdapter == null) {
return;
}
if (view instanceof WXCircleIndicator) {
return;
}
FrameLayout wrapper = new FrameLayout(getContext());
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.CENTER;
view.setLayoutParams(params);
wrapper.addView(view);
super.addSubView(wrapper,index);
updateAdapterScaleAndAlpha(mNeighborAlpha, mNeighborScale); // we need to set neighbor view status when added.
view.postDelayed(WXThread.secure(new Runnable() {
@Override
public void run() {
int childCountByDomTree = getNeighborChildrenCount();
if(mAdapter.getRealCount() == childCountByDomTree || childCountByDomTree == -1) { // -1 mean failed at get child count by travel the dom tree.
mViewPager.setPageTransformer(false, createTransformer());
}
}
}), 100); // we need to set the PageTransformer when all children has been rendered.
}
示例13: convertEmptyViewLayoutParams
import android.widget.FrameLayout; //导入方法依赖的package包/类
private static FrameLayout.LayoutParams convertEmptyViewLayoutParams(ViewGroup.LayoutParams lp) {
FrameLayout.LayoutParams newLp = null;
if (null != lp) {
newLp = new FrameLayout.LayoutParams(lp);
if (lp instanceof LinearLayout.LayoutParams) {
newLp.gravity = ((LinearLayout.LayoutParams) lp).gravity;
} else {
newLp.gravity = Gravity.CENTER;
}
}
return newLp;
}
示例14: onCreate
import android.widget.FrameLayout; //导入方法依赖的package包/类
public void onCreate() {
activity.getWindow().setBackgroundDrawable(new ColorDrawable(0xfff3f3f3));
llPage = new LinearLayout(activity);
llPage.setOrientation(LinearLayout.VERTICAL);
activity.setContentView(llPage);
rlTitle = new RelativeLayout(activity);
float ratio = getRatio();
int titleHeight = (int) (getDesignTitleHeight() * ratio);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, titleHeight);
llPage.addView(rlTitle, lp);
initTitle(rlTitle, ratio);
View line = new View(activity);
LinearLayout.LayoutParams lpline = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, (int) (ratio < 1 ? 1 : ratio));
line.setBackgroundColor(0xffdad9d9);
llPage.addView(line, lpline);
FrameLayout flPage = new FrameLayout(getContext());
LinearLayout.LayoutParams lpFl = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
lpFl.weight = 1;
flPage.setLayoutParams(lpFl);
llPage.addView(flPage);
// 关注(或朋友)列表
PullToRequestView followList = new PullToRequestView(getContext());
FrameLayout.LayoutParams lpLv = new FrameLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
followList.setLayoutParams(lpLv);
flPage.addView(followList);
adapter = new FriendAdapter(this, followList);
adapter.setPlatform(platform);
adapter.setRatio(ratio);
adapter.setOnItemClickListener(this);
followList.setAdapter(adapter);
// 请求数据
followList.performPullingDown(true);
}
示例15: layoutLocationBar
import android.widget.FrameLayout; //导入方法依赖的package包/类
@SuppressLint("RtlHardcoded")
private boolean layoutLocationBar(int containerWidth) {
// Note that Toolbar's direction depends on system layout direction while
// LocationBar's direction depends on its text inside.
FrameLayout.LayoutParams locationBarLayoutParams =
getFrameLayoutParams(getLocationBar().getContainerView());
// Chrome prevents layout_gravity="left" from being defined in XML, but it simplifies
// the logic, so it is manually specified here.
locationBarLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
int width = 0;
int leftMargin = 0;
// Always update the unfocused layout params regardless of whether we are using
// those in this current layout pass as they are needed for animations.
updateUnfocusedLocationBarLayoutParams();
if (mLayoutLocationBarInFocusedMode || mVisualState == VisualState.NEW_TAB_NORMAL) {
int priorVisibleWidth = 0;
for (int i = 0; i < mLocationBar.getChildCount(); i++) {
View child = mLocationBar.getChildAt(i);
if (child == mLocationBar.getFirstViewVisibleWhenFocused()) break;
if (child.getVisibility() == GONE) continue;
priorVisibleWidth += child.getMeasuredWidth();
}
width = containerWidth - (2 * mToolbarSidePadding) + priorVisibleWidth;
if (ApiCompatibilityUtils.isLayoutRtl(mLocationBar)) {
leftMargin = mToolbarSidePadding;
} else {
leftMargin = -priorVisibleWidth + mToolbarSidePadding;
}
} else {
width = mUnfocusedLocationBarLayoutWidth;
leftMargin = mUnfocusedLocationBarLayoutLeft;
}
boolean changed = false;
changed |= (width != locationBarLayoutParams.width);
locationBarLayoutParams.width = width;
changed |= (leftMargin != locationBarLayoutParams.leftMargin);
locationBarLayoutParams.leftMargin = leftMargin;
return changed;
}