37其他资源

使用ImageSpan对象在TextView中显示图像
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
ImageSpan imageSpan = new ImageSpan(this, bitmap);
SpannableString spannableString = new SpannableString("icon");
spannableString.setSpan(imageSpan, 0, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.setText(spannableString);
使用<img>标签的TextView中显示图像
CharSequence charSequence = Html.fromHtml(html, new ImageGetter(){
    public Drawable getDrawable(String source){
        Drawable drawable = getResources().getDrawable(getResourceId(source));
        drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
        return drawable;
    }
}, null);
textView.setText(charSequence);
改变按钮状态
<?xml version="1.0" encoding="utf-8">
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true"
         android:drawable="@drawable/pressed" />
    <item android:state_focused="true"
         android:drawable="@drawable/focused" />
    <item android:state_pressed="normal"
         android:drawable="@drawable/normal" />
</selector>
截取图像
Bitmap samllBitmap = Bitmap.createBitmap(sourceBitmap, 20, 20, 100, 100);
imageView.setImageBitmap(smallBitmap);
图像加边框
首先做一个透明的带边框的nine-patch格式图像
然后通过<ImageView>的android:background属性指定背景
适配器:
SimpleAdapter/BaseAdapter
反射技术
Android应用程序中执行JavaScript
WebView webView = new WebView(this);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
webView.loadDataWithBaseURL(null, s, "text/html", "uft-8", null);
全局对象
android.app.Application
package mobile.android.transmit.data;
import android.app.Application;
public class MyApp extends Application{
    public String country;
    public Data data = new Data();
}
配置:
<application android:name=".MyApp" android:icon="@drawable/icon" android:label="@string/app_name">
使用
MyApp myApp = (MyApp)getApplicationContext();
通过剪切板传递复杂数据
服务和AIDL
SharedPreferences
加密:MD5/SHA/HMAC/AES BASE64
Android系统资源





你可能感兴趣的:(MD5,android,加密,bitmap,application)