自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(76)
  • 收藏
  • 关注

原创 ImageButton状态图片的获得

如果使用一些特殊效果如按下去 释放 获得焦点这样的背景每次都不一样要想知道使用的是哪个有一个本办法ImageButton btn = (ImageButton) findViewById(R.id.btn);      int [] states = btn.getDrawableState();     for (int i : states) {         if (i == an...

2010-06-30 21:23:28 373

原创 图片作为邮件内容发出去

1.这里呢图片是作为邮件的内容发出去而不是作为附件其实很简单就是在里面加入html标签就好了 然后 "text/html类型发出去<img src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGA...

2010-06-30 21:19:13 292

原创 获得当前位置

MyLocation myLocation = new MyLocation(); private void locationClick() {     myLocation.getLocation(this, locationResult)); }  public LocationResult locationResult = new LocationResult(){     @Overrid...

2010-06-30 12:18:52 83

原创 让back建和home建一样的效果

@overidepublic void onBackPressed() {   Log.d("CDA", "onBackPressed Called");   Intent setIntent = new Intent(Intent.ACTION_MAIN);   setIntent.addCategory(Intent.CATEGORY_HOME);   setIntent.setFlags(I...

2010-06-30 12:16:20 70

原创 对值转换

其实这个看起来更像是java文件 嘿嘿"key"="value"转换成<string name="key"> value </string>public static void main(String[] args) throws IOException { Scanner fileScanner = new Scan...

2010-06-30 12:11:20 68

原创 WebView获得头文件

private WebView webview; public void onCreate(Bundle icicle){ webview = new WebView(this); webview.setWebViewClient(new YourWebClient()); } private class YourWebClient extend...

2010-06-29 16:10:56 213

原创 activity之间全局变量的使用

import uk.co.kraya.HelloWS;import android.content.Context;import android.content.SharedPreferences;import android.content.SharedPreferences.Editor; public class Settings { private stati...

2010-06-28 12:59:34 379

原创 alarm周期发送

alarm一小时发送// We want the alarm to go off 30 seconds from now. long firstTime = SystemClock.elapsedRealtime(); firstTime += remainingMilisecondsToTopHour; long a=c.getTimeInMillis();   AlarmManager a...

2010-06-28 12:55:00 106

原创 图片放大缩小

 import android.app.Activity;import android.os.Bundle; public class zooming extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(B...

2010-06-27 13:05:21 73

原创 listView分割线

<ListView android:id="@id/android:list"   android:layout_width="fill_parent"    android:layout_height="fill_parent"   android:layout_weight="1"   android:headerDividersEnabled="false"   android:foo..

2010-06-27 13:03:45 125

原创 button的大小修改及随机数的使用

1. 根据不同的形式修改button需要重写 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {       int w = <calculation>       int h = <calculation>       setMeasuredDimension(w, h);  ...

2010-06-26 16:46:51 141

原创 AlertDialog背景的修改

AlertDialog背景的修改是不允许使用xml的去修改的如果你是用<style name="MyOpaqueActivity" parent="@android:style/Theme.Dialog">     <item name="android:windowBackground">@drawable/my_background</item>  ..

2010-06-26 16:44:59 182

原创 透明主题

/res/values/style.xml<resources> <style name="Transparent"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowAnimationStyle"&gt

2010-06-26 16:41:34 141

原创 多个button一个监听

有时候为了方便需要一个监听应用在多个buttonButton btn1, btn2; public void onCreate(Bundle b) {         btn1.setOnClickListener(yourListener);     btn2.setOnClickListener(yourListener); }  View.OnClickListener yourList...

2010-06-26 15:11:01 486

原创 popWindow返回键不能消失的原因

今天弄了一下popoWindows弹出来之后 不小心按了一下返回键,竟然不消失我很纳闷怎么会这样 按理说按了返回键应该返回的原来需要设置setBackgroundDrawable(new BitmapDrawable()) 也就是说background != null 真汗 而且如果想让他消失当你按窗口其他部分时别忘 了setOutsideTouchable(true)...

2010-06-26 15:06:24 222

原创 ExpandableListView的扩展

public class ExpandableExample extends ExpandableListActivity {     @Override     public void onCreate() {         super.onCreate(savedInstanceState);         setListAdapter(new BaseExpandableListAdap...

2010-06-25 11:37:20 57

原创 tabhost的图标

TabHost tabHost = getTabHost(); TabHost.TabSpec spec; Intent intent;  intent = new Intent().setClass(this, YourClass.class); spec = tabHost.newTabSpec("tab_name").setIndicator("Tab Text",             ...

2010-06-25 11:33:43 154

原创 异步图片

final File imageFile = new File(getCacheDir().getPath() + "/img/" + p.image); image.setVisibility(View.GONE); view.findViewById(R.id.imageLoading).setVisibility(View.VISIBLE); (new AsyncTask<Void, ...

2010-06-23 16:14:43 79

原创 键盘数字

// TYPE_CLASS_NUMBER: Class for numeric text. This displays the numbers/symbols keyboard. editText.setInputType(TYPE_CLASS_NUMBER);  // TYPE_CLASS_PHONE: Class for a phone number. This displays the ph...

2010-06-23 15:44:35 45

原创 重写类的引用问题

今天重写了一个public class FixedFlipper extends ViewFlipper{ public FixedFlipper(Context context){     super(context); }  public FixedFlipper(Context context, AttributeSet attrs){     super(context, attrs); ...

2010-06-23 15:37:34 100

原创 判断真机还是模拟器

 TelephonyManager telmgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);                 String deviceID = telmgr.getDeviceId();                 boolean isEmulator = "0000000000000...

2010-06-23 15:14:59 183

原创 修改亮度以及命令行

int brightness = 125;  Settings.System.putInt(       ftaContext.getContentResolver(),        Settings.System.SCREEN_BRIGHTNESS,  );        brightness 2.public static void doCmds(List<String...

2010-06-23 12:19:06 2322

原创 sms信息的获得

public List<String> getSms() { Uri mSmsQueryUri = Uri.parse("content://sms/inbox"); List<String> messages = new ArrayList<String>(); Cursor cursor = nul...

2010-06-23 12:00:06 103

原创 输出SQLite database 到sd卡

    public static class ExportDatabaseFileTask extends AsyncTask<String, Void, Boolean> {         private Context ctx;                 public ExportDatabaseFileTask(Context ctx) {             su...

2010-06-23 11:36:20 70

原创 webView显示progress indicator

  @Override public void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     getWindow().requestFeature(Window.FEATURE_PROGRESS);      setContentView(R.layout.browser);   ...

2010-06-23 11:32:54 112

原创 图标综合android

http://www.androidicons.com/

2010-06-23 09:39:43 80

原创 2.1做拐角的bug

本来想在左下 左上弄一个拐角<stroke android:width="3dp"          android:color="#555555"          />   <padding android:left="1dp"           android:top="1dp"           android:right="1dp"        

2010-06-22 20:55:31 130

原创 转移字符

'&'  转为\u0026怎么差呢 有个网站http://jrgraphix.net/research/unicode_blocks.php?block=0 

2010-06-22 20:53:41 78

原创 pixel转DIP

在Paint.setTextSize()中用到的是像素,没有更好的兼容性的话 应该用dip那么如何转化呢private static final float GESTURE_THRESHOLD_DIP = 16.0f;  final float scale = getContext().getResources().getDisplayMetrics().density; mGesture...

2010-06-22 15:44:25 77

原创 listView隔行设置颜色重写SimpleAdapter

import java.util.HashMap;import java.util.List;import android.content.Context;import android.view.View;import android.view.ViewGroup;import android.widget.SimpleAdapter;public class Sp...

2010-06-22 15:41:03 249

原创 调用系统计算器

Intent i = new Intent(); i.setClassName("com.android.calculator2",                "com.android.calculator2.Calculator"); startActivity(i);  

2010-06-22 13:47:23 235

原创 下载html源码

 public void getHtml() throws ClientProtocolException, IOException {     HttpClient httpClient = new DefaultHttpClient();     HttpContext localContext = new BasicHttpContext();     HttpGet httpGet = n...

2010-06-22 13:35:38 198

原创 语言读短信

public class TextSpeaker2 extends Activity implements OnInitListener,OnClickListener{ public static final Uri SMS_CONTENT_URI = Uri.parse("content://sms"); public static final Uri SMS_INBOX_CON...

2010-06-22 13:24:42 105

原创 radiogroup判断选择的单个选项

radiogroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {          void onCheckedChanged(RadioGroup rg, int checkedId) {               for(int i=0; i<rg.getChildCount(); i++)...

2010-06-22 13:21:51 1302

原创 在一个图上画图

Bitmap b=BitmapFactory.decodeResource(CON.getResources(),R.drawable.deltio);     Bitmap bmOverlay = Bitmap.createBitmap(b.getWidth(), b.getHeight(), b.getConfig()); canvas = new Canvas(bmOverlay); Pai...

2010-06-22 12:52:19 90

原创 类似搜索的布局

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="horizontal"     android:layout_width="fill_parent"     android:layout_height="fill_parent">    &...

2010-06-22 12:51:29 72

原创 imageView设置网址图片

myImageView.setImageURI(Uri.parse(http://example.com/logo.png)); 2.try {     URL thumb_u = new URL("http://www.example.com/image.jpg");     Drawable thumb_d = Drawable.createFromStream(thumb_u.openS...

2010-06-21 21:59:16 305

原创 超时链接

HttpPost httpPost = new HttpPost(url); StringEntity se = new StringEntity(envelope,HTTP.UTF_8); httppost.setEntity(se);  HttpParams httpParameters = new BasicHttpParams(); // Set the timeout in millis...

2010-06-21 21:57:32 97

原创 传递long variable

Intent i = new Intent(ProjectList.this,RoleList.class);   Bundle c = new Bundle();               c.putLong("PID", projectID );   c.putLong("CTSID", castingTimeSlotID);   i.putExtras(c);   startActivit...

2010-06-21 21:56:44 71

原创 整个程序所有textView字体颜色一个杨

1. 样式与主题<?xml version="1.0" encoding="utf-8"?> <resources>   <style name="MyRedTheme" parent="android:Theme.Light">     <item name="android:textAppearance"

2010-06-21 18:10:04 73

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除