`
文章列表
在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 ...

日志demo

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 ...
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 ...
自写button及触摸滑动效果,还有一些listiview

获得系统分辨率

/* 取得屏幕对象 */ Display display= ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); /* 取得屏幕解析像素 */ intScreenX = dm.widthPixels; intScreenY = dm.heightPixels; controlHeight = intScreenY/4;
Global site tag (gtag.js) - Google Analytics