• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LayoutParams类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.support.design.widget.CoordinatorLayout.LayoutParams的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams类的具体用法?Java LayoutParams怎么用?Java LayoutParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LayoutParams类属于android.support.design.widget.CoordinatorLayout包,在下文中一共展示了LayoutParams类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: layoutChild

import android.support.design.widget.CoordinatorLayout.LayoutParams; //导入依赖的package包/类
protected void layoutChild(CoordinatorLayout parent, View child, int layoutDirection) {
    View header = findFirstDependency(parent.getDependencies(child));
    if (header != null) {
        LayoutParams lp = (LayoutParams) child.getLayoutParams();
        Rect available = this.mTempRect1;
        available.set(parent.getPaddingLeft() + lp.leftMargin, header.getBottom() + lp.topMargin, (parent.getWidth() - parent.getPaddingRight()) - lp.rightMargin, ((parent.getHeight() + header.getBottom()) - parent.getPaddingBottom()) - lp.bottomMargin);
        Rect out = this.mTempRect2;
        GravityCompat.apply(resolveGravity(lp.gravity), child.getMeasuredWidth(), child.getMeasuredHeight(), available, out, layoutDirection);
        int overlap = getOverlapPixelsForOffset(header);
        child.layout(out.left, out.top - overlap, out.right, out.bottom - overlap);
        this.mVerticalLayoutGap = out.top - header.getBottom();
        return;
    }
    super.layoutChild(parent, child, layoutDirection);
    this.mVerticalLayoutGap = 0;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:HeaderScrollingViewBehavior.java


示例2: updateFabVisibility

import android.support.design.widget.CoordinatorLayout.LayoutParams; //导入依赖的package包/类
private boolean updateFabVisibility(CoordinatorLayout parent, AppBarLayout appBarLayout, FloatingActionButton child) {
    if (((LayoutParams) child.getLayoutParams()).getAnchorId() != appBarLayout.getId() || child.getUserSetVisibility() != 0) {
        return false;
    }
    if (this.mTmpRect == null) {
        this.mTmpRect = new Rect();
    }
    Rect rect = this.mTmpRect;
    ViewGroupUtils.getDescendantRect(parent, appBarLayout, rect);
    if (rect.bottom <= appBarLayout.getMinimumHeightForVisibleOverlappingContent()) {
        child.hide(null, false);
    } else {
        child.show(null, false);
    }
    return true;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:FloatingActionButton.java


示例3: offsetIfNeeded

import android.support.design.widget.CoordinatorLayout.LayoutParams; //导入依赖的package包/类
private void offsetIfNeeded(CoordinatorLayout parent, FloatingActionButton fab) {
    Rect padding = fab.mShadowPadding;
    if (padding != null && padding.centerX() > 0 && padding.centerY() > 0) {
        LayoutParams lp = (LayoutParams) fab.getLayoutParams();
        int offsetTB = 0;
        int offsetLR = 0;
        if (fab.getRight() >= parent.getWidth() - lp.rightMargin) {
            offsetLR = padding.right;
        } else if (fab.getLeft() <= lp.leftMargin) {
            offsetLR = -padding.left;
        }
        if (fab.getBottom() >= parent.getBottom() - lp.bottomMargin) {
            offsetTB = padding.bottom;
        } else if (fab.getTop() <= lp.topMargin) {
            offsetTB = -padding.top;
        }
        fab.offsetTopAndBottom(offsetTB);
        fab.offsetLeftAndRight(offsetLR);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:FloatingActionButton.java


示例4: subscribeActual

import android.support.design.widget.CoordinatorLayout.LayoutParams; //导入依赖的package包/类
@Override protected void subscribeActual(Observer<? super View> observer) {
  if (!checkMainThread(observer)) {
    return;
  }
  if (!(view.getLayoutParams() instanceof LayoutParams)) {
    throw new IllegalArgumentException("The view is not in a Coordinator Layout.");
  }
  LayoutParams params = (LayoutParams) view.getLayoutParams();
  final SwipeDismissBehavior behavior = (SwipeDismissBehavior) params.getBehavior();
  if (behavior == null) {
    throw new IllegalStateException("There's no behavior set on this view.");
  }
  Listener listener = new Listener(behavior, observer);
  observer.onSubscribe(listener);
  behavior.setListener(listener);
}
 
开发者ID:JakeWharton,项目名称:RxBinding,代码行数:17,代码来源:SwipeDismissBehaviorObservable.java


示例5: onCreate

import android.support.design.widget.CoordinatorLayout.LayoutParams; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_swipe_behavior);


	final SwipeDismissBehavior swipe = new SwipeDismissBehavior();
	swipe.setSwipeDirection(SwipeDismissBehavior.SWIPE_DIRECTION_ANY);
	swipe.setListener(new SwipeDismissBehavior.OnDismissListener() {
		@Override public void onDismiss(View view) {
			Toast.makeText(SwipeBehaviorExampleActivity.this,
				"Card swiped !!", Toast.LENGTH_SHORT).show();
		}

		@Override public void onDragStateChanged(int state) {}
	});

	CardView cardView = (CardView) findViewById(R.id.swype_card);
	LayoutParams coordinatorParams = (LayoutParams) cardView.getLayoutParams();
	coordinatorParams.setBehavior(swipe);
}
 
开发者ID:saulmm,项目名称:CoordinatorExamples,代码行数:22,代码来源:SwipeBehaviorExampleActivity.java


示例6: onDependentViewChanged

import android.support.design.widget.CoordinatorLayout.LayoutParams; //导入依赖的package包/类
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionButton floatingActionButton, View dependency) {

    if (dependency instanceof AppBarLayout) {

        AppBarLayout appBarLayout = (AppBarLayout) dependency;
        LayoutParams lp = (LayoutParams) floatingActionButton.getLayoutParams();
        int distanceToScroll = floatingActionButton.getHeight() + lp.bottomMargin;
        float ratio = ViewCompat.getY(appBarLayout) / (float) appBarLayout.getTotalScrollRange();
        ViewCompat.setTranslationY(floatingActionButton, -distanceToScroll * ratio);
        return true;
    }
    return super.onDependentViewChanged(parent, floatingActionButton, dependency);
}
 
开发者ID:joy-inc,项目名称:joy-library,代码行数:15,代码来源:FloatingActionButtonBehavior.java


示例7: onDependentViewChanged

import android.support.design.widget.CoordinatorLayout.LayoutParams; //导入依赖的package包/类
@Override
public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionButton floatingActionButton, View dependency) {
    if (dependency instanceof AppBarLayout) {
        AppBarLayout appBarLayout = (AppBarLayout) dependency;
        LayoutParams lp = (LayoutParams) floatingActionButton.getLayoutParams();
        int distanceToScroll = floatingActionButton.getHeight() + lp.bottomMargin;
        float ratio = ViewCompat.getY(appBarLayout) / (float) appBarLayout.getTotalScrollRange();
        ViewCompat.setTranslationY(floatingActionButton, -distanceToScroll * ratio);
        return true;
    }
    return super.onDependentViewChanged(parent, floatingActionButton, dependency);
}
 
开发者ID:joy-inc,项目名称:core-ui,代码行数:13,代码来源:FloatingActionButtonBehavior.java


示例8: Base

import android.support.design.widget.CoordinatorLayout.LayoutParams; //导入依赖的package包/类
Base(CoordinatorLayout parent, View child) {
  super(parent.getContext());
  // Draw at the same level of the child.
  parent.addView(this, parent.indexOfChild(child),
      new LayoutParams(MATCH_PARENT, MATCH_PARENT));
}
 
开发者ID:JakeWharton,项目名称:DrawerBehavior,代码行数:7,代码来源:ContentScrimDrawer.java



注:本文中的android.support.design.widget.CoordinatorLayout.LayoutParams类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AbstractASTTransformation类代码示例发布时间:2022-05-23
下一篇:
Java SecuredAction类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap