andorid取消最上方的标题同时全屏显示

Source code    
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//取消最上方的标题栏
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.splash);
//全屏显示
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

整个app取消标题

android:theme=”@android:style/Theme.Translucent.NoTitleBar”

获取版本号

Source code    
  1. private String getVersion() {
  2. try {
  3. // getPackageName()得到当前应用包名,当前应用的版本号通过包管理器得到
  4. PackageInfo info = getPackageManager().getPackageInfo(
  5. getPackageName(), 0);
  6. return info.versionName;
  7. } catch (Exception e) {
  8. e.printStackTrace();
  9. return "没得到";
  10. }
  11. }

淡入淡出动画效果

Source code    
  1. rl_splash_animation = (RelativeLayout) findViewById(R.id.rl_splash_animation);
  2. //从完全透明到完全不透明动画效果
  3. AlphaAnimation a = new AlphaAnimation(0.0f, 1.0f);
  4. a.setDuration(2000);//动画时间两秒钟
  5. rl_splash_animation.setAnimation(a);

弹出对话框,下面的代码,是一个升级提醒,仅供参考。

Source code    
  1. /**
  2. * 升级的对话框
  3. */
  4. private void showUpdataDialog() {
  5. AlertDialog.Builder buider = new Builder(this);
  6. buider.setIcon(R.drawable.icon5);
  7. buider.setTitle("升级提醒");
  8. buider.setMessage(info.getDescription());
  9. buider.setCancelable(false); // 让用户不能取消对话框
  10. buider.setPositiveButton("确定", new OnClickListener() {
  11. public void onClick(DialogInterface dialog, int which) {
  12. Log.i(TAG, "下载apk文件" + info.getApkurl());
  13. if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
  14. DownLoadFileThreadTask task = new DownLoadFileThreadTask(info.getApkurl(), "/sdcard/new.apk");
  15. pd.show();
  16. new Thread(task).start();
  17. }else{
  18. Toast.makeText(getApplicationContext(), "sd卡不可用", 1).show();
  19. loadMainUI();
  20. }
  21. }
  22. });
  23. buider.setNegativeButton("取消", new OnClickListener() {
  24. public void onClick(DialogInterface dialog, int which) {
  25. Log.i(TAG, "用户取消进入程序主界面");
  26. loadMainUI();
  27. }
  28. });
  29. buider.create().show();
  30. }

从服务器是获取xml文件,然后解析的一个业务方法

首先传入id这个id是在values里边的一个xml配置文件的id里边是服务器xml文件的地址

然后通过

HttpURLConnection连接服务器,
InputStream is = conn.getInputStream();发送请求得到输入流
Source code    
  1. /**
  2. *
  3. * @param urlid 服务器路径string对应的id
  4. * @return 更新的信息
  5. */
  6. public UpdataInfo getUpdataInfo(int urlid) throws Exception{
  7. String path = context.getResources().getString(urlid);
  8. URL url = new URL(path);
  9. HttpURLConnection conn = (HttpURLConnection) url.openConnection();
  10. conn.setConnectTimeout(2000);
  11. conn.setRequestMethod("GET");
  12. InputStream is = conn.getInputStream();
  13. return UpdataInfoParser.getUpdataInfo(is);
  14. }

解析的xml的inputstream,传入xml文件的

inputstream流,读取里边的文件
Source code    
  1. /**
  2. *
  3. * @param is
  4. * 解析的xml的inputstream
  5. * @return updateinfo
  6. */
  7. public static UpdataInfo getUpdataInfo(InputStream is) throws Exception {
  8. XmlPullParser parser = Xml.newPullParser();
  9. UpdataInfo info = new UpdataInfo();
  10. parser.setInput(is, "utf-8");
  11. int type = parser.getEventType();//定位到文档的开始
  12. while (type != XmlPullParser.END_DOCUMENT) {//不到末尾
  13. switch (type) {
  14. case XmlPullParser.START_TAG:
  15. if("version".equals(parser.getName())){
  16. String version = parser.nextText();
  17. info.setVersion(version);
  18. }else if("description".equals(parser.getName())){
  19. String description = parser.nextText();
  20. info.setDescription(description);
  21. }else if("apkurl".equals(parser.getName())){
  22. String apkurl = parser.nextText();
  23. info.setApkurl(apkurl);
  24. }
  25. break;
  26. }
  27. type = parser.next();//向下
  28. }
  29. return info;
  30. }
Intent如何传值
Source code    
  1. 案例一
  2. 传值:
  3. Intent intent=new Intent();
  4. intent.putExtra("extra", "这是页面一传来的值!");
  5. intent.setClass(Test_for_intentActivity.this, actpage2.class);
  6. startActivity(intent);
  7. 取值:
  8. Intent intent=getIntent();
  9. String StringE=intent.getStringExtra("extra");
  10. TextView text2=(TextView)findViewById(R.id.textView2);
  11. text2.setText(StringE);
  12. 打开网页
  13. Uri uri = Uri.parse("http://www.google.com");
  14. Intent it = new Intent(Intent.ACTION_VIEW,uri);
  15. startActivity(it);

android中细节效果总结的更多相关文章

  1. Android中的LinearLayout布局

    LinearLayout : 线性布局 在一般情况下,当有很多控件需要在一个界面列出来时,我们就可以使用线性布局(LinearLayout)了,  线性布局是按照垂直方向(vertical)或水平方向 ...

  2. Android中BroadcastReceiver的两种注册方式(静态和动态)详解

    今天我们一起来探讨下安卓中BroadcastReceiver组件以及详细分析下它的两种注册方式. BroadcastReceiver也就是"广播接收者"的意思,顾名思义,它就是用来 ...

  3. Android中使用ExpandableListView实现微信通讯录界面(完善仿微信APP)

    之前的博文<Android中使用ExpandableListView实现好友分组>我简单介绍了使用ExpandableListView实现简单的好友分组功能,今天我们针对之前的所做的仿微信 ...

  4. Android中ListView实现图文并列并且自定义分割线(完善仿微信APP)

    昨天的(今天凌晨)的博文<Android中Fragment和ViewPager那点事儿>中,我们通过使用Fragment和ViewPager模仿实现了微信的布局框架.今天我们来通过使用Li ...

  5. Android中Fragment和ViewPager那点事儿(仿微信APP)

    在之前的博文<Android中使用ViewPager实现屏幕页面切换和引导页效果实现>和<Android中Fragment的两种创建方式>以及<Android中Fragm ...

  6. Android中Fragment与Activity之间的交互(两种实现方式)

    (未给Fragment的布局设置BackGound) 之前关于Android中Fragment的概念以及创建方式,我专门写了一篇博文<Android中Fragment的两种创建方式>,就如 ...

  7. 【月入41万】Mono For Android中使用百度地图SDK

    借助于Mono For Android技术,.Net开发者也可以使用自己熟悉的C#语言以及.Net来开发Android应用.由于Mono For Android把Android SDK中绝大部分类库都 ...

  8. mono for android中使用dapper或petapoco对sqlite进行数据操作

    在mono for android中使用dapper或petapoco,很简单,新建android 类库项目,直接把原来的文件复制过来,对Connection连接报错部分进行注释和修改就可以运行了.( ...

  9. Android开发学习之路-Android中使用RxJava

    RxJava的核心内容很简单,就是进行异步操作.类似于Handler和AsyncTask的功能,但是在代码结构上不同. RxJava使用了观察者模式和建造者模式中的链式调用(类似于C#的LINQ). ...

随机推荐

  1. JS/CSS/IMG加载顺序关系之DOMContentLoaded事件

    DOMContentLoaded介绍 DOMContentLoaded事件的触发条件是: 将会在“所有的DOM全部加载完毕并且JS加载执行后触发”. 但如果“js是通过动态加载进来的话,是不会影响到D ...

  2. phpmyadmin自增字段

    自增字段必须为primary key 2种方法: 1- ALTER TABLE `qr_role` CHANGE `ROLE_ID` `ROLE_ID` INT(11) NOT NULL AUTO_I ...

  3. js 当前系统时间

    <script language=Javascript> function time(){ //获得显示时间的div t_div = document.getElementById('sh ...

  4. windows下配置lamp环境(2)---配置Apache服务器2.2.25

    配置Apache 配置Apache时,先要找到安装目录中的主配置文httpd.conf,使用文本编辑器打开,最好不要使用windows自带的编辑器,可以使用NotePad++, vim,或者subli ...

  5. C程序设计语言练习题1-1

    练习1-1 在你自己的系统中运行"hello, world"程序.再有意去掉程序中的部分内容,看看会得到什么出错信息. 代码如下: #include <stdio.h> ...

  6. zookeeper笔记--配置以及和spark hbase结合使用

    Spark集群基于ZooKeeper的搭建:http://www.dataguru.cn/thread-333245-1-1.html Spark需要修改的地方: 进入spark的配置目录,参照下面代 ...

  7. 成为IT精英,我奋斗了7年

    成为IT精英,我奋斗了7年 这些日子 我一直在写一个实时操作系统内核,已有小成了,等写完我会全部公开,希望能够为国内IT的发展尽自己一份微薄的力量.最近看到很多学生朋友和我当年一样没有方向 ,所以把我 ...

  8. C51 Keil 优化

    对程序进行优化,通常是指优化程序代码或程序执行速度.优化代码和优化速度实际上是一个予盾的统一,一般是优化了代码的尺寸,就会带来执行时间的增加,如果优化了程序的执行速度,通常会带来代码增加的副作用,很难 ...

  9. Python 在Visual studio 中做单元测试进行TDD开发

    Unit Tests Steve Dower edited this page on 14 Jul · 3 revisions Pages 38 Home Azure Remote Debugging ...

  10. logstash 各种时间转换

    <pre name="code" class="html">日期格式转换: /***** nginx 访问日志 [elk@zjtest7-front ...