android琐碎日记七

对于自定义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}); 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值