【MVP】与toolbar相关的实现+progressWheel进度条
来源:互联网 发布:linux中怎么创建文件 编辑:程序博客网 时间:2024/05/29 19:17
自我学习使用,共同进步
之前先要除去系统的状态栏
<style name="Theme.AppCompat.Light.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style>
再写view_toolbar.xml布局文件,包含toolbar和ProgressWheel
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:wheel="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/blue" app:theme="@style/ToolbarStyle" /> <com.xiaoyuan.hloli.weiget.view.ProgressWheel android:id="@+id/progressWheel" android:layout_width="25dp" android:layout_height="45dp" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:layout_marginRight="20dp" wheel:matProg_barColor="@color/white" wheel:matProg_barWidth="2dp" /> </RelativeLayout></LinearLayout>
在写Java文件
@Bind(R.id.toolbar) @Nullable Toolbar toolbar; @Bind(R.id.progressWheel) @Nullable ProgressWheel progressWheel; public void initBaseToolbar(int titleResId,Boolean canBack){ assert toolbar != null; toolbar.setTitle(titleResId); toolbar.setTitleTextColor(Color.WHITE); setSupportActionBar(toolbar); if(canBack && getSupportActionBar() != null){ getSupportActionBar().setHomeButtonEnabled(true); //设置返回键可用 getSupportActionBar().setDisplayHomeAsUpEnabled(true); } } public void initBaseToolBar(String titleStr, boolean canBack) { assert toolbar != null; toolbar.setTitle(titleStr); toolbar.setTitleTextColor(Color.WHITE); setSupportActionBar(toolbar); if (canBack && getSupportActionBar() != null) { getSupportActionBar().setHomeButtonEnabled(true); //设置返回键可用 getSupportActionBar().setDisplayHomeAsUpEnabled(true); } } public void showLoading(){ if (progressWheel != null && !progressWheel.isSpinning()){ progressWheel.isSpinning(); } } public void stopLoading(){ if (progressWheel !=null&& progressWheel.isSpinning()){ progressWheel.stopSpinning(); } }
阅读全文
0 0
- 【MVP】与toolbar相关的实现+progressWheel进度条
- ProgressWheel
- ProgressWheel:Android开源圆环进度条
- MVP架构的理解与实现Demo
- MVP实战心得(四)---封装优化,拆分Toolbar与ContentView
- MVP实战心得(四)---封装优化,拆分Toolbar与ContentView
- 通用进度条的设计与实现【C#】
- 自定义ToolBar的实现
- MVP模式的相关知识
- MVP模式的相关知识
- MVP模式的相关知识
- MVP的实现
- 基于ToolBar等MD相关控件实现的沉浸式联动效果
- 基于Android Architecture Blueprints的MVP案例分析与实现
- android的进度条相关知识
- VC中Toolbar的相关代码
- toolbar相关的主题属性设置
- IE Toolbar 的实现思路
- JAVA序列化
- 好用的编辑工具打造总结
- leetcode53. Maximum Subarray (简单dp)
- 左右两栏(或多块)都要加载
- hdoj 5015 233 Matrix
- 【MVP】与toolbar相关的实现+progressWheel进度条
- win10中如何成功安装lxml
- Linux wext和nl80211接口简介
- 关于Autosar中DCM(14229UDS)模块的理解
- centos发行版视频解码问题的解决
- 单向链表-移动
- CURL发送HTTP请求获得Json数据串保存在本地(linux 下 C++ 编程)
- MySQL 修改字段类型或长度
- CodeForces