记录一些有用的代码片

隐藏输入法

((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
                                .hideSoftInputFromWindow(LoginActivity.this
                                                .getCurrentFocus().getWindowToken(),
                                                InputMethodManager.HIDE_NOT_ALWAYS);

 

ListView 里加入了CheckBox 之类的控件后,不能相应Item的点击事件,可以在Item的xml文件中加入:

android:descendantFocusability="blocksDescendants"

 

使用onPrepareOptionsMenu刷新menu,不点击menu按钮,动态刷新menu中的item:

this.getWindow().invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL);

 

更改ProgressBar的高度:

自定义Style(在Style里面设置高度):
</style>
    <style name="tallerBarStyle" parent="@android:style/Widget.SeekBar" >
    <item name="android:indeterminateOnly">false</item>
    <item name="android:progressDrawable">@android:drawable/progress_horizontal</item>
    <item name="android:indeterminateDrawable">@android:drawable/progress_horizontal</item>
    <item name="android:minHeight">8dip</item>
    <item name="android:maxHeight">20dip</item>
</style>


ProgressBar里面引用Style:
<ProgressBar
        android:id="@+id/show_progressbar"
        style="@style/tallerBarStyle" />

 

posted on 2014-02-24 17:23  怒吃三两饭  阅读(155)  评论(0)    收藏  举报

导航