1,关于text和drawableTop之类的间距html
android:drawablePadding="10dp"
java代码里设置自定义的字体颜色java
counetdownView.setTextColor(mContext.getColorStateList(R.color.text_pre_white_to_gary));
listViewandroid
2,商城分类浏览ide
列表单选效果布局
去掉分割线字体
设置list模式(含多个)code
默认选中第一个htm
3,edittext属性blog
Android:phoneNumber=”true” //输入电话号 android:maxLength=“50” 字数限制 Android:editable // 是否可编辑 代码中清除焦点-不会改变编辑状态 edittext.clearFocus(); 在EditText中软键盘的调起、关闭 android:focusable="false"//禁止获取焦点 在父布局设置如下两个属性,取消默认获取焦点 android:focusable="true" android:focusableInTouchMode="true" android:cursorVisible="false" 隐藏光标 android:background="#00000000"//不要文本框背景 android:numeric来控制输入的数字类型,一共有三种分别为integer(正整数)、signed(带符号整数,有正负)和decimal(浮点数)。 软键盘的调起致使原来的界面被挤上去,或者致使界面下面的tab导航被挤上去,解决方法以下 解决方法: 使用Manifest中的Activity的android:windowSoftInputMode的"adjustPan"属性。 另外注意:有关软键盘的问题可参考android:windowSoftInputMode中属性。 (1)EditText有焦点(focusable为true)阻止输入法弹出 editText=(EditText)findViewById(R.id.txtBody); editText.setOnTouchListener(new OnTouchListener(){ public boolean onTouch(View v, MotionEvent event){ editText.setInputType(InputType.TYPE_NULL); //关闭软键盘 return false; } }); 当EidtText无焦点(focusable=false)时阻止输入法弹出 InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(editText.getWindowToken(),0); //关闭键盘(好比输入结束后执行) InputMethodManager imm =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(etEditText.getWindowToken(), 0); //自动弹出键盘 ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).toggleSoftInput(0,InputMethodManager.HIDE_NOT_ALWAYS); etEditText.requestFocus();//让EditText得到焦点,可是得到焦点并不会自动弹出键盘
,4,用于RecyclerView的adapter刷新数据,只有把新的数据传到adapter里而后notifyDataSetChanged()就能够了,若是数据不少,固然也有针对单条的数据更改事件
public void refresh(List<Variety> list) { mVarietyList = list; notifyDataSetChanged();//刷新所有数据 //notifyItemInserted(1); 新添加一条 //notifyItemRemoved(1);删除一条 }
五、ImageView图片位置
http://www.cnblogs.com/pandapan/p/4614837.html
6.若是滑动里嵌套列表,事件冲突 ,若是列表只是用于显示,最简单的就是把列表控件的事件取消
mRecyclerView.setNestedScrollingEnabled(false);
7.SearchView使用,搜索后由展开到关闭(缩小)
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { //query:输入框内容 //设置两次setIconified是为了让searchView收缩 searchView.setIconified(true);//设置一次是清空内容 searchView.setIconified(true);//缩小 return false; } @Override public boolean onQueryTextChange(String newText) { return false; } });