93杀毒的UI实现
来源:互联网 发布:linux vi怎么保存退出 编辑:程序博客网 时间:2024/05/29 20:02
实现后的效果如图:
布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#f2f0eb" android:orientation="vertical" > <TextView android:id="@+id/title" android:layout_width="match_parent" android:layout_height="50dp" android:background="#2FD5B9" android:gravity="center" android:text="手机杀毒" android:textColor="#ffffff" android:textSize="20sp" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="80dip" android:orientation="horizontal" > <FrameLayout android:layout_width="80dip" android:layout_height="80dip" > <ImageView android:layout_width="80dip" android:layout_height="80dip" android:src="@drawable/ic_scanner_malware" /> <ImageView android:id="@+id/iv_scan" android:layout_width="80dip" android:layout_height="80dip" android:src="@drawable/act_scanning_03" /> </FrameLayout> <LinearLayout android:layout_width="fill_parent" android:layout_height="80dip" android:gravity="center" android:orientation="vertical" > <TextView android:id="@+id/tv_scan_status" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:text="扫描状态" android:textColor="#000000" android:textSize="18sp" /> <ProgressBar android:id="@+id/progressBar1" style="?android:attr/progressBarStyleHorizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dip" android:layout_marginRight="10dip" android:progressDrawable="@drawable/progress_horizontal" /> </LinearLayout> </LinearLayout> <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:id="@+id/ll_container" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > </LinearLayout> </ScrollView></LinearLayout>
包含下面的几部分内容:
一是动画,而是扫描状态的文字,三是扫描的进度条,四是下面扫描到的包名,可能文本很多,使用了ScrollView包裹了。
关心的是进度条的实现:
其一是:
style="?android:attr/progressBarStyleHorizontal"
指定了其样式;
其二是:
android:progressDrawable="@drawable/progress_horizontal"这个对应的drawable文件为:
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2008 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.--><layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background" android:drawable="@drawable/security_progress_bg"> </item> <item android:id="@android:id/secondaryProgress" android:drawable="@drawable/security_progress"> </item> <item android:id="@android:id/progress" android:drawable="@drawable/security_progress"> </item> </layer-list>
注意这里的结点是:layer-list(将多个图层堆叠到一块)
类文件指定动画:
package com.ustc.mobilemanager;import android.app.Activity;import android.os.Bundle;import android.view.Window;import android.view.animation.Animation;import android.view.animation.RotateAnimation;import android.widget.ImageView;import android.widget.ProgressBar;public class AntiVirusActivity extends Activity {private ImageView iv_scan;private ProgressBar progressBar1;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);requestWindowFeature(Window.FEATURE_NO_TITLE);setContentView(R.layout.activity_anti_virus);iv_scan = (ImageView) findViewById(R.id.iv_scan);progressBar1 = (ProgressBar) findViewById(R.id.progressBar1);progressBar1.setMax(100);new Thread(new Runnable() {@Overridepublic void run() {for (int i = 0; i < 100; i++) {try {Thread.sleep(100);progressBar1.setProgress(i);} catch (Exception e) {e.printStackTrace();}}}}).start();RotateAnimation ra = new RotateAnimation(0, 360,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);ra.setDuration(1000);ra.setRepeatCount(Animation.INFINITE);iv_scan.setAnimation(ra);}}
0 0
- 93杀毒的UI实现
- 138.杀毒功能的实现
- 94手机杀毒的逻辑实现
- 手动杀毒的例子
- 趋势杀毒的后遗症
- 杀毒的华山论剑
- 一次郁闷的杀毒
- 经典的杀毒方法
- 我的杀毒工具箱
- 杀毒,可恶的onLineGames
- autorun 的杀毒方法
- 杀毒软件的杀毒原理
- 杀毒引擎的原理
- 关于杀毒的解决方案
- Android学习 动画 杀毒实现
- 43、手机杀毒--代码实现
- 杀毒!!
- 杀毒
- IMDG中的陷阱和问题
- 用excel, notepad++ 快速整理sql字段名,并快速完成将某个存储过程的查询结果插入到某张表
- redhat7 使用163 yum源 以及 epel源
- iOS字符串NSString中去掉空格(或替换为某个字符串)
- android studio快捷键
- 93杀毒的UI实现
- Struts2下载及简介
- c#string 方法
- 招投标阶段的内部控制要点
- 手势 view tag
- vimdiff比较两个文件
- uva 106 Fermat vs. Pythagoras(勾股数求法)
- java中重载与重写的区别
- 非师范生的