有些需求为了与软件风格保持一致需要自定义控件。progressdialog重写如下:
public class MofficeProgressDialog extends Dialog
{
LayoutInflater inflater;
Context context;
TextView titleText;
static MofficeProgressDialog mofficeProgressDialog = null;
TextView message;
ImageView diverse;
public MofficeProgressDialog(Context context)
{
super(context);
this.context = context;
}
public static MofficeProgressDialog create(Context context)
{
mofficeProgressDialog = new MofficeProgressDialog(context, null);
return mofficeProgressDialog;
}
public MofficeProgressDialog(Context context, AttributeSet attr)
{
super(context, R.style.CustomProgressDialog);
this.context = context;
setContentView(R.layout.mofficeprogressdialog);
// inflater = (LayoutInflater)context.getSystemService(Service.LAYOUT_INFLATER_SERVICE);
}
public MofficeProgressDialog setTitle(String title)
{
titleText = (TextView)mofficeProgressDialog.findViewById(R.id.title);
if (!StringUtils.isEmpty(title.toString()))
{
titleText.setVisibility(View.VISIBLE);
titleText.setText(title.toString());
diverse = (ImageView)mofficeProgressDialog.findViewById(R.id.dirves);
diverse.setVisibility(View.VISIBLE);
}
return mofficeProgressDialog;
}
public MofficeProgressDialog setTitleById(int titleId)
{
titleText = (TextView)mofficeProgressDialog.findViewById(R.id.title);
String titleStr = context.getResources().getString(titleId);
if (!StringUtils.isEmpty(titleStr))
{
titleText.setVisibility(View.VISIBLE);
titleText.setText(titleStr);
diverse = (ImageView)inflater.inflate(R.layout.mofficeprogressdialog, null).findViewById(R.id.dirves);
diverse.setVisibility(View.VISIBLE);
}
return mofficeProgressDialog;
}
public MofficeProgressDialog setMessageById(int messageId)
{
message = (TextView)mofficeProgressDialog.findViewById(R.id.message);
String titleStr = context.getResources().getString(messageId);
if (!StringUtils.isEmpty(titleStr))
{
message.setText(titleStr);
}
return mofficeProgressDialog;
}
public MofficeProgressDialog setMessage(String messages)
{
message = (TextView)mofficeProgressDialog.findViewById(R.id.message);
if (!StringUtils.isEmpty(messages.toString()))
{
message.setText(messages.toString());
}
return mofficeProgressDialog;
}
}
mofficeprogressdialog.xml文件如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:background="@drawable/linearlayout_selector" android:layout_height="fill_parent">
<TextView android:id="@+id/title" android:layout_width="fill_parent"
android:textSize="15sp" android:textColor="#000000" android:layout_marginLeft="5dp"
android:visibility="gone"
android:layout_height="wrap_content" />
<ImageView android:visibility="invisible" android:background="@drawable/dialog_diverse"
android:layout_width="fill_parent" android:layout_height="1dp"
android:id="@+id/dirves"></ImageView>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_marginRight="5dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" android:layout_marginBottom="10dp"
android:orientation="horizontal">
<com.hanwei.demo.MofficeProgressBar
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" />
</LinearLayout>
<TextView android:id="@+id/message" android:layout_width="wrap_content"
android:singleLine="true" android:layout_height="wrap_content"
android:textSize="13sp" android:textColor="#000000"
android:text="@string/hello" android:layout_gravity="center_vertical" />
</LinearLayout>
</LinearLayout>
其中自定义的progressBar用之前提到的自定义控件。
分享到:
相关推荐
scratch少儿编程逻辑思维游戏源码-上下飞行.zip
kkzhilu_Code-Generate_32152_1745864907745
艺术博客_SpringSpringMVCMybatisShirojQueryBootstrapechartswebuploaderlayui_博客管理图表数据日
scratch少儿编程逻辑思维游戏源码-面具古墓.zip
scratch少儿编程逻辑思维游戏源码-时钟上的冰块.zip
健康监测_Android开发_BLE蓝牙通信_心率数据采集与存储_基于小米手环2的实时心率监测应用_支持后台长时间运行的心率记录工具_可导出SQLite数据库的心率数据分析系统_适
scratch少儿编程逻辑思维游戏源码-梦魇忍者.zip
scratch少儿编程逻辑思维游戏源码-谁建得更高.zip
scratch少儿编程逻辑思维游戏源码-忍者攀登.zip
模拟端 后端 qt前端
数据可视化_Android原生Canvas绘图_3D与非3D柱形图饼图折线图面积图曲线图环形图玫瑰图雷达图散点图气泡图仪表盘刻度盘漏斗图象限图_支持手势缩放滑动交互多图叠加动画效果
scratch少儿编程逻辑思维游戏源码-米克 demo.zip
聚合支付系统/官方个人免签系统/三方支付系统稳定安全高并发 附教程 系统采用FastAdmin框架独立全新开发,安全稳定,系统支持代理、商户、码商等业务逻辑。 针对最近一些JD,TB等业务定制,子账号业务逻辑API 非常详细,方便内置对接! IP白名单 业务逻辑 支持IP白名单,黑名单,全局白名单,全局黑名单,保障系统的安全。 接口验签名 采用支付宝RSA加密接口方式,防止篡改数据,导致对账困难,资金大量损失,无故少钱 对接灵活 全部对接参数灵活操作 风控完善 轮询、交易金额、随机金额、最大金额、最小金额等 测试环境: Nginx+PHP7.0+MySQL5.6 网站运行目录:/public 伪静态设置为:thinkphp规则 数据库信息修改路径:/application/database.php
第一步 package.json 下载这三个包 shelljs :执行 shell命令 ssh2-sftp-client 与服务器建立链接(内部有ssh2) chalk 打印彩色输出 第二步 配置脚本命令 deploy 注意后边加上运行环境 执行deploy命令时内部执行了打包动作 「 "deploy": "node deploy/index.js --prod」 第三步准备服务器密码 账号 部署地址 备份地址等等 参考如下 放到 config.js 中 module.exports = [ { id: 0, nodeEnv: "prod", name: "正式环境", domain: "", host: "ip", port: 端口, username: "用户名", password: "密码", path: "/data/www/paccount",//部署路径 removepath: "/data/www/paccount", //删除路径 }, ]; 第四步 如果需要在服务器执行命令 在部署完成后执行 chmodDir 自行决定
scratch少儿编程逻辑思维游戏源码-恐怖矿井.zip
scratch少儿编程逻辑思维游戏源码-爬墙鸟.zip
scratch少儿编程逻辑思维游戏源码-亮灯.zip
scratch少儿编程逻辑思维游戏源码-神秘的游戏.zip
scratch少儿编程逻辑思维游戏源码-矿猫 V4.zip
scratch少儿编程逻辑思维游戏源码-射击游戏构建.zip