Android系列 -- 1、 初识android

1、为什么要学习android

    首先感叹下,开始接触android 应该是在几年前,当时工作第一次接触到需要做app。当时怀着很大的兴趣去学习,但后来没有坚持下来(在这里鄙视自己一下)。随着移动互联的普及,智能手机的重要性越来越强,公司项目也逐渐开始向移动端发生转变,促使自己不得不掌握相关方便的知识。

2、制定学习计划

    人是逼出来的,给自己一个月时间,每天至少两个小时进行学习。目标:掌握android开发要领

3、废话不多说

     从简单的Hello程序开始,哈哈,貌似有点老套路了

     首先认识下清单文件:AndroidManifest.xml

     

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 3     package="com.example.rocky.hello" >
 4 
 5     <application
 6         android:allowBackup="true"        
 7         android:icon="@mipmap/ic_launcher" /*指定图标*/
 8         android:label="@string/app_name"   /*指定标签*/
 9         android:theme="@style/AppTheme" >  /*主题样式*/
10         <activity
11             android:name=".MainActivity"
12             android:label="@string/app_name" >   /*定义一个activity组件*/
13             <intent-filter>
14                 <action android:name="android.intent.action.MAIN" />  /*指定该activity是程序入口*/
15 
16                 <category android:name="android.intent.category.LAUNCHER" />
17             </intent-filter>
18         </activity>
19     </application>
20 
21 </manifest>

android:icon="@mipmap/ic_launcher" 和 android:icon="@drawable/icon" 的区别在于:用mipmap系统会在缩放上提供一定的性能优化

官方介绍:

Mipmapping for drawables

Using a mipmap as the source for your bitmap or drawable is a simple way to provide a quality image and various image scales, which can be particularly useful if you expect your image to be scaled during an animation.

Android 4.2 (API level 17) added support for mipmaps in the Bitmap class—Android swaps the mip images in your Bitmap when you've supplied a mipmap source and have enabled setHasMipMap(). Now in Android 4.3, you can enable mipmaps for a BitmapDrawable object as well, by providing a mipmap asset and setting the android:mipMap attribute in a bitmap resource file or by calling hasMipMap().

原文地址:https://www.cnblogs.com/wzxiang/p/4489238.html