- 浏览: 426116 次
- 性别:
- 来自: 深圳
最新评论
-
xinzhengjie:
服务器用什么实现
pjsip -
yxhloen01:
只放debug.keystore但是没给密码啊。。。。。。 ...
静默安装实现方法 -
tabolt:
android 应用强制停止 -
li1046964106:
[color=green][size=x-small][ali ...
安卓图表引擎AChartEngine(二) - 示例源码概述和分析 -
smallk2013:
用你这个方法为什么我只想模拟点击 无法实现啊
Android下执行Runtime.getRuntime().exec后返回状态
文章列表
在Android SDK中说明可以支持的图片格式如下:png , jpg , gif,和bmp。
1.Bitmap的创建
借助于BitmapFactory。
1)资源中的图片
使用BitmapFactory获取位图
Bitmap bmp = BitmapFactory.decodeResource(this.getResources(), R.drawable.testImg);
或者是
Resources res=getResources();
//使用BitmapDrawable获取位图
//使用BitmapDrawable (InputStream is)构造一个BitmapDraw ...
1.public void onCreate(Bundle icicle) {
setContentView(R.layout.main);
ListView myListView = (ListView)findViewById(R.id.myListView);
final EditText myEditText = (EditText)findViewById(R.id.myEditText);
// Create the array list of to do items
final ArrayList<String> todoItems = new ArrayList< ...
1.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:layout_height=”fill_parent”>
<TextView
android:layout_width=”fill_parent”
android:layout_he ...
1.添加surfaceview上点击事件,左右滚动等事件。
private SurfaceView mPreview;
public SurfaceHolder holder;
mPreview = (SurfaceView) findViewById(R.id.fullplayer);
mPreview.setOnTouchListener(this);
holder = mPreview.getHolder();
holder.addCallback(this);
public boolean onTouch(View v, MotionEvent event) {
ret ...
package com.eoeandroid.demo.testcode;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import andro ...
代码调用drawable中的资源
- 博客分类:
- android 图片处理
1.drawable
Resources res = mContext.getResources();
Drawable myImage = res.getDrawable(R.drawable.my_image);
风格:
1.<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SpecialText" parent="@style/Text">
<item name="android:textSize">18sp</item>
<item name="android:textColor">#008</item>
</styl ...
1、Drawable → Bitmap
public static Bitmap drawableToBitmap(Drawable drawable) {
Bitmap bitmap = Bitmap
.createBitmap(
drawable.getIntrinsicWi ...
显示网页
1. Uri uri = Uri.parse("http://google.com");
2. Intent it = new Intent(Intent.ACTION_VIEW, uri);
3. startActivity(it);
显示地图
1. Uri uri = Uri.parse("geo:38.899533,-77.036476");
2. Intent it = new Intent(Intent.ACTION_VIEW, uri);
3. start ...
public class CustomTabhost extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int width =45;
int height =48;
final TabHos ...
public class CustomDialog extends Dialog {
public CustomDialog(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.custom_dialog);
Lay ...
隐式启动
<service android:name=".service">
<intent-filer>
<action android:name="com.android.service"/>
<intent-filer>
</service>
final Intent serviceIntent=new Intent();
serviceIntent.setAction("com.android.service");
显示启动
final Intent serviceIn ...
public class FileList extends Activity{
ListView filelist;
private static final String MEDIA_PATH = "/sdcard/";
List<String> txt = new ArrayList<String>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindow ...
/* 取得屏幕对象 */
Display display= ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
/* 取得屏幕解析像素 */
intScreenX = dm.widthPixels;
intScreenY = dm.heightPixels;
controlHeight = intScreenY/4;