- 博客(26)
- 资源 (2)
- 问答 (1)
- 收藏
- 关注
转载 自动换行的ViewGroup
public class AutoNewLineViewGroup extends ViewGroup { private final static int VIEW_MARGIN = 10;// 控件之间间距 public AutoNewLineViewGroup(Context context) { super(context); } public AutoNewLineVi
2013-08-31 23:49:52 1688 1
转载 为自定义ViewGroup组件绘制边框
@Override protected void dispatchDraw(Canvas canvas) { // 获取布局控件宽高 int width = getWidth(); int height = getHeight(); // 创建画笔 Paint mPaint = new Paint(); // 设置画笔的各个属性 mPaint.setColor(Col
2013-08-31 20:48:35 2116
原创 FindViewById
有种代码COPY器的感觉!public class ActionPlanActivity extends Activity { private EditText et_actionplan11; private EditText et_actionplan12; private EditText et_actionplan13; private EditText et_actionpl
2013-08-30 14:29:34 838
转载 Android换字体
//自定义字体字型custom=new TextView(this);//字体MgOpenCosmeticaBold.ttf放置于assets/font/路径下typeface=Typeface.createFromAsset(getAssets(),"font/MgOpenCosmeticaBold.ttf");custom.setTypeface(typeface);cus
2013-08-29 22:49:38 830
原创 TableLayout里的EditText,会自动下移!
记录一下:在中间EditText中写文字,当每换一行,那个EditText就会自动下移一行的距离,直到EditText移动到最中间就不会移了。最后解决办法: center_vertical center第一行让当前EditText的布局权重为垂直居中!
2013-08-29 22:37:18 1890
原创 TableLayout表格布局,自适应内容
先上效果图:布局代码:<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tl_table" android:layout_width="match_parent" android:layout_height="mat
2013-08-29 10:25:44 4008
原创 旋转的Button
做项目遇到的。N个Button按圆形旋转。main.xml<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_paren
2013-08-27 22:09:24 706
原创 手势识别
今天做项目,问题:在Activity中左右滑屏,里面的Button也能响应点击事件。重写dispatchTouchEvent(),而非onTouchEvent()代码如下:注意返回值的写法,不能动! @Override public boolean dispatchTouchEvent(MotionEvent ev) { // // 2、让手势识别器
2013-08-23 17:28:20 625
原创 Android发带附件和图片的邮件
核心代码: Authenticator authenticator = new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("wang_yanlong_
2013-08-20 15:34:31 3398 1
翻译 SQLITE中插入一条记录
update TAB1 set ID = ID + 1 where ID > 4;insert into TAB1(ID, NAME) values(5, 'new_name');
2013-08-19 23:23:28 4464
原创 调用Android手机自带的闪光灯
关键代码:@Override protected void onNewIntent(Intent intent) { Logger.i("onNewIntent"); super.onNewIntent(intent); if (opened) { // 关闭 // parameters = mCamera.getParameters(); parameters
2013-08-19 12:08:13 1712
原创 Android旋转动画不停顿
package com.example.demoandroid;import android.app.Activity;import android.os.Bundle;import android.view.MotionEvent;import android.view.animation.Animation;import android.view.animation.Animati
2013-08-19 11:50:48 18301 2
原创 更改RadioButton的背景
android:background="@drawable/bg_selector"android:button="@null"
2013-08-15 13:51:42 2605
转载 HttpClient基本使用
http://ipjmc.iteye.com/blog/1577495//先将参数放入List,再对参数进行URL编码List params = new LinkedList();params.add(new BasicNameValuePair("param1", "中国"));params.add(new BasicNameValuePair("param2", "value2"))
2013-08-13 21:39:54 600
原创 Bitmap转换为Drawable
BitmapDrawable bitmapDrawable = new BitmapDrawable(bitmap);BitmapDrawable是Drawable的子类。
2013-08-11 01:17:18 532
原创 图片伸展
Bitmap mBitmap = Bitmap.createScaledBitmap(bmp, mScreenWidth, mScreenHeight, true);
2013-08-10 23:21:33 538
原创 SQLITE3和MySql的自动增长
1、Sqlite3:CREATE TABLE person (personid INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(20))2、MySql:CREATE TABLE person (personid INTEGER PRIMARY KEY AUTO_INCREMENT, name VARCHAR(20))
2013-08-10 18:43:42 1139
翻译 自定义控件
1、继承至View①重写构造②重写onTouchEvent();③在上面的方法中调用invalidate();//它会自动调用onMeasure()和onDraw()④重写onMeasure()⑤重写onDraw()//这里用Canvas和Paint还有Matrix画界面,主要用到canvas.drawBitmap(Bitmap bitmap, float left,
2013-08-08 23:29:32 508
原创 Android备份App及数据
1、要有Root权限,和sd卡写权限2、备份App本身//引用:http://blog.csdn.net/KPRF2009/article/details/8277996private void backupApp(String packageName) throws IOException { File in = new File("/data/app/" +
2013-08-08 23:02:20 5705
原创 倒序字符串
/** * 按指定规则,倒序字符串 * @author Melon 2013/8/7 */public class ReverseString { /** * @param args */ public static void main(String[] args) { String str = "I love you AnHui_LuAn_HuoQiu ( my-hom
2013-08-07 23:01:37 661
转载 Touch事件传递,简记
①首先触发 Activity 的dispatchTouchEvent②然后触发 Activity 的onUserInteraction③然后触发Layout(即ViewGroup)的dispatchTouchEvent④然后触发Layout(即ViewGroup)的onInterceptTouchEvent⑤最后触发View的onTouchEvent细节:当TouchEvent发生时
2013-08-05 22:36:29 604
原创 Activity启动模式记录
android:launchMode="standard":这种启动模式下,每startActivity()一次,即在内存中创建一下实例。android:launchMode="singleTop":如果在栈的顶端有该activity的引用存在,则再一次startActivity()不会onCreate创建新的,而是复用存在的实例,调用onNewIntent()方法。android:l
2013-08-04 10:13:57 797
原创 Bitmap.createBitmap那个最长参数的方法
Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height,Matrix m, boolean filter)最后一个:filter解释true if the source should be filtered. Only applies if the matrix contains
2013-08-02 18:58:16 19479
关于UltraEdit语法彩色显示的问题
2012-01-03
TA创建的收藏夹 TA关注的收藏夹
TA关注的人