---------------------------------------------------------------------------------------------------------------------------------------------------------
1.文字中间横线加效果:
text.setText("横线");
text.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
---------------------------------------------------------------------------------------------------------------------------------------------------------
2.去掉TobHost下面的横线:
tabHost.setPadding(tabHost.getPaddingLeft(), tabHost.getPaddingTop(), tabHost.getPaddingRight(), tabHost.getPaddingBottom()-适当的数字);
---------------------------------------------------------------------------------------------------------------------------------------------------------
3.TabHost中在Tab组内打开新的Intent:
在TabHost中打开新的Intent时,按照通常的方法,会丢失Tab组,这时的Activity要继承自ActivityGroup,同时用如下方法打开新的Intent——
public class MyActivity extends ActivityGroup {
....
Intent intent = new Intent(Class.this, New.class);
intent.putExtra...
View view_record = getLocalActivityManager().startActivity(TAG, intent).getDecorView();
setContentView(view_record);
....
}
---------------------------------------------------------------------------------------------------------------------------------------------------------
4.软键盘挡住空间的问题:
在manifest的activity使用
<activity android:windowSoftInputMode="adjustResize" . . . >
当点击EditText控件弹出软键盘时,系统会自动调整控件的位置。
---------------------------------------------------------------------------------------------------------------------------------------------------------
5.Activity横竖屏转换不重载:
给每个activity加上android:configChanges="keyboardHidden|orientation"属性,就不会重启activity.
而是去调用onConfigurationChanged(Configuration newConfig). 这样就可以在这个方法里调整显示方式.
例:
if(newConfig.orientation==Configuration.ORIENTATION_LANDSCAPE){
//横向
setContentView(R.layout.file_list_landscape);
}else{
//竖向
setContentView(R.layout.file_list);
}
---------------------------------------------------------------------------------------------------------------------------------------------------------
6.过滤字符串中所有Tag标签:
private String stripTags(final String pHTMLString) {
return pHTMLString.replaceAll("\\<.*?>","");
}
---------------------------------------------------------------------------------------------------------------------------------------------------------
7.修改ListView分割线Seperator Line:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ListView
android:id="@+id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:divider="#FFCC00"
android:dividerHeight="4px"/>
</LinearLayout>
<span style="white-space:pre"> </span> android:divider="#FFCC00"
android:dividerHeight="4px"
---------------------------------------------------------------------------------------------------------------------------------------------------------
8.解决TextView显示小方格:
这个问题,是回车符("\r")引起的。所以在TextView要显示的文字过滤掉回车符("\r")就可以正常显示了。
---------------------------------------------------------------------------------------------------------------------------------------------------------
9. Android4: 请放弃使用Theme.Dialog
4.0上如果还用Theme.Dialog,只能说很土,跟整体UI风格差别很大
请使用android:theme="@android:style/Theme.Holo.DialogWhenLarge"
上效果对比图:
@android:style/Theme.Holo.DialogWhenLarge:
@android:style/Theme.Dialog