本文整理汇总了Java中android.widget.FrameLayout.getLayoutParams方法的典型用法代码示例。如果您正苦于以下问题:Java FrameLayout.getLayoutParams方法的具体用法?Java FrameLayout.getLayoutParams怎么用?Java FrameLayout.getLayoutParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.FrameLayout
的用法示例。
在下文中一共展示了FrameLayout.getLayoutParams方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
import android.widget.FrameLayout; //导入方法依赖的package包/类
public void initView(Context context) {
setOrientation(LinearLayout.VERTICAL);
View view = View.inflate(context, R.layout.appdetail_item_desc, null);
titleTextView = (TextView) view.findViewById(R.id.detail_desc_title_textview);
contentTextView = (TextView) view.findViewById(R.id.detail_desc_content_textview);
foldImage = (ImageView) view.findViewById(R.id.detail_desc_folding_imageview);
flContent = (FrameLayout) view.findViewById(R.id.fl_content);
flContent.getLayoutParams().height = getTileHeight() + getShortHeight();
contentTextView.setOnClickListener(this);
foldImage.setOnClickListener(this);
contentTextView.setTag(false);
foldImage.setTag(false);
addView(view);
}
示例2: 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;
}
示例3: setFrameLayoutHeight
import android.widget.FrameLayout; //导入方法依赖的package包/类
/**
* Establish framelayout size based on screen height
*
* @param frameId Framelayout id
*/
private void setFrameLayoutHeight(int frameId) {
FrameLayout layout = (FrameLayout) findViewById(frameId);
ViewGroup.LayoutParams params = layout.getLayoutParams();
params.height = (screenHeight - convertDipToPixels(180)) / getResources().getInteger(R.integer.frame_layout_divider);
layout.setLayoutParams(params);
}
示例4: setForceShowHint
import android.widget.FrameLayout; //导入方法依赖的package包/类
public void setForceShowHint(boolean enabled, CharSequence hint) {
CharSequence oldHint = mForceHint;
mForceHint = hint;
if (enabled == mForceShowHint)
return;
mWasHintEnabled = isHintEnabled();
if (enabled)
setHintEnabled(false);
mForceShowHint = enabled;
FrameLayout inputFrame = (FrameLayout) getChildAt(0);
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) inputFrame.getLayoutParams();
int newTopMargin = 0;
if (enabled) {
newTopMargin = (int) -mTextPaint.ascent();
}
if(newTopMargin != lp.topMargin) {
lp.topMargin = newTopMargin;
inputFrame.requestLayout();
}
if (!enabled) {
setHintEnabled(mWasHintEnabled);
setHint(oldHint);
}
}
示例5: setParallaxMultiplier
import android.widget.FrameLayout; //导入方法依赖的package包/类
@ReactProp(name = "parallaxMultiplier")
public void setParallaxMultiplier(FrameLayout view, float multiplier) {
CollapsingToolbarLayout.LayoutParams params = (CollapsingToolbarLayout.LayoutParams) view.getLayoutParams();
params.setParallaxMultiplier(multiplier);
view.setLayoutParams(params);
}
开发者ID:cesardeazevedo,项目名称:react-native-collapsing-toolbar,代码行数:7,代码来源:CollapsingParallaxManager.java
示例6: onCreate
import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (loggedIn) {
Intent myIntent = new Intent(MainActivity.this, PostCallActivity.class);
MainActivity.this.startActivity(myIntent);
} else {
Snackbar.make(findViewById(R.id.container), getString(R.string.error_logged_in), Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
if (savedInstanceState == null) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction ft = fragmentManager.beginTransaction();
ft.replace(R.id.container, WelcomeFragment.newInstance(loggedIn));
ft.commit();
}
FrameLayout frameLayout = (FrameLayout) findViewById(R.id.content_frame);
if (((ViewGroup.MarginLayoutParams)frameLayout.getLayoutParams()).leftMargin == (int) getResources().getDimension(R.dimen.drawer_size)) {
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
drawer.setScrimColor(Color.TRANSPARENT);
isDrawerLocked = true;
Log.d(TAG, "Drawer locked");
}
if (!isDrawerLocked) {
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
}
}
示例7: onStart
import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
protected void onStart() {
super.onStart();
final FrameLayout sheet = (FrameLayout) findViewById(R.id.design_bottom_sheet);
if (sheet != null) {
mBehavior = BottomSheetBehavior.from(sheet);
mBehavior.setBottomSheetCallback(mBottomSheetCallback);
// skip the collapsed state
mBehavior.setSkipCollapsed(true);
// tablet's land
if (getContext().getResources().getBoolean(R.bool.tablet_landscape)) {
CoordinatorLayout.LayoutParams layoutParams
= (CoordinatorLayout.LayoutParams) sheet.getLayoutParams();
layoutParams.width = getContext().getResources().getDimensionPixelOffset(R.dimen.bottomsheet_width);
sheet.setLayoutParams(layoutParams);
}
// Make sure the sheet doesn't overlap the appbar
if (mAppBarLayout != null) {
if (mAppBarLayout.getHeight() == 0) {
mAppBarLayout.getViewTreeObserver()
.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
applyAppbarMargin(sheet);
}
});
} else {
applyAppbarMargin(sheet);
}
}
// land
if (getContext().getResources().getBoolean(R.bool.landscape)) {
fixLandscapePeekHeight(sheet);
}
if (mExpandOnStart) {
sheet.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
mBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
if (mBehavior.getState() == BottomSheetBehavior.STATE_SETTLING
&& mRequestedExpand) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
sheet.getViewTreeObserver().removeOnGlobalLayoutListener(this);
} else {
//noinspection deprecation
sheet.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
}
mRequestedExpand = true;
}
});
}
}
}