协调布局,能够协调多个控件的位置关系,可以实现让FAB上下滑动,展开或折叠ToolBar,控制View扩展收缩以及放大缩小
使用需要依赖design类库:
compile 'com.android.support:design:23+'
CoordinatorLayout和FloatingActionButton使用
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!--pressedTranslationZ : 按下的阴影
rippleColor : 按下渐变的颜色
fabSize : 设置按钮的大小
backgroundTint : 背景色
-->
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:src="@mipmap/ic_done"
android:layout_margin="20dp"
app:pressedTranslationZ="90dp"
app:rippleColor="#00FF00"
app:fabSize="normal"
app:backgroundTint="#0000FF"
/>
</android.support.design.widget.CoordinatorLayout>
<android>协调布局的使用
最新推荐文章于 2024-12-09 10:04:14 发布
本文介绍如何使用CoordinatorLayout和FloatingActionButton实现控件位置协调、上下滑动效果及按钮的自定义样式设置。
2411

被折叠的 条评论
为什么被折叠?



