TitleLayout
多功能、通用的、可在布局或者使用Java代码实现标题栏;
支持沉浸式状态栏;
支持左侧返回按钮不需要手动实现页面返回;
支持左侧按钮,中间标题,右边按钮点击
左侧支持图片+文字、单独图片、单独文字;右侧支持单独图片、单独文字等。
图片有点虚,请见谅
堆码不易,star支持,万分感谢
欢迎关注:
重点说明:
若左侧文字或者按钮为返回键,只需要布局中使用如下代码即可;
dante:d_is_back_view="true"
或者Java代码中
titleLayout.setIsLeftBackView(true)
无须在设置onClickListener,this.finish等;如有特殊需要,可设置属性为false,实现方法:
setLeftClickListener(OnClickListener listener)
若项目中使用了沉浸式状态栏,则需要在布局中
dante:d_is_immersive_state_bar="true"
设置页面为沉浸式状态栏方法:
ScreenUtil.setStatusTranslucent(this);
Gradle依赖:
dependencies {
compile 'com.github.SiberiaDante:TitleLayout:v1.0.1'
}
在布局中使用:
android:id="@+id/title_layout_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
dante:d_is_back_view="true"
dante:d_is_immersive_state_bar="true"
dante:d_left_image="@mipmap/back_gray"
dante:d_left_image_padding_start="10dp"
dante:d_left_image_width="30dp"
dante:d_left_text="测试"
dante:d_left_text_color="@color/black"
dante:d_left_text_padding_start="10dp