对于自定义view 想动态修改里面的属性:<com.xxx.android.components.TopMenu
android:layout_width="fill_parent"
android:layout_height="44dp"
/>
如果你开始是<com.xxx.android.components.TopMenu />
然后想变成上面的样子加上宽度和高度之类的属性不能用set LayoutParams
而可以在onFinishInflate() 中设置
2.让一个对话框无标题栏
Dialog dialog = new Dialog(this, android.R.style.Theme_Translucent_NoTitleBar);
3. 关系自动提示EditText
EditText txtTypeIt = (EditText) this.findViewById(R.id.txtTypeIt); txtTypeIt.setInputType(524288);
4.远端下载图片
http://www.anddev.org/gallery_with_remote_images-t769.html
5.程序安装完 自动启动 不是运行一次后每次自动启动通过BOOT_COMPLETED ,这种方法目前还没有实现智能通过间接方法
SharedPreferences prefs = getPreferences(MODE_PRIVATE);
if (!prefs.contains(KEY_FIRST_RUN)) {
/* do some one-off stuff here */
prefs.edit().putBoolean(KEY_FIRST_RUN, false).commit();
}
每次进行检查。
6.如果SMS超过了160x3 characters 他会自动转换成MMS 在模拟机上
7.在EditViewView中显示时间
EditText editText = (EditText) findViewById( R.id.your_edittext_id );
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy/MM/dd" );
editText.setText( sdf.format( new Date() ));
8.去除背景色 可以考虑使用一下
android:background="@android:color/transparent"
9.SimpleCursorAdapter sca = new SimpleCursorAdapter(this, R.layout.log_item,c,new String[] {DBAdapter.KEY_LOG_TRIPDATE, DBAdapter.KEY_FOO, DBAdapter.KEY_BAR},new int[]{R.id.txtTripDate, R.id.otherid1, R.id.otherid2});