使用RecyclerView 时,在xml文件中设置宽度match_parent无效. View view = mInflater.from(mContext).inflate(R.layout.item_recycler_view, parent, false); 对于:inflate public View inflate(int resource, ViewGroup root, boolean attachToRoot) { if (DEBUG) System.out.println("…
在RecyclerView中宽度设置了match_parent,但是效果和wrap_content一样: 说下解决方法: 1.这样子写,match_parent没有效果: View v = View.inflate(context,R.layout.item_service_manage,null); 2.这样子写,match_parent设置生效:推荐这样写. LayoutInflater.from(context).inflate(R.layout.item_service_manage,…
在对Android的EditText控件进行设置时,经常会限定一下输入法的属性,设置右下角为完成或者搜索等,一般都会想到android:imeOptions属性,但是仅仅这么设置通常是无效的,还要搭配另外一些属性. <!-- 添加singleLine属性或者inputType属性, 注意inputType,我测试的是只能设为text --> <EditText android:id="@+id/editText1" android:layout_width="…
RecyclerView是用来替代ListView.GridView的一个牛掰的控件.用起来更灵活,还能实现线性布局(横向.纵向).网格布局.瀑布流等美观的UI. 在使用RecyclerView时候,必须指定一个适配器Adapter和一个布局管理器LayoutManager.适配器继承RecyclerView.Adapter类 首先在build.gradle中加入依赖库 dependencies { implementation fileTree(dir: 'libs', include: ['…
在viewpager当中直接使用layout_width="wrap_content"是无效的,扩展了一下.解决这个问题. package com.soulagou.ui; import android.content.Context; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.ViewGroup; import android.vie…
一直一来对android:layout_height.android:layout_width.android:height.android:width这几个属性的关系有些不理解,既然有了android:layout_height和android:layout_width为什么还要有android:height.android:width呢?网上搜了好久发现都是重复一句扯淡的话,今天下午抽时间好好研究了下发现只有android:layout_height和android:layout_width…
  android:width 其实是定义控件上面的文本(TextView) 的宽度,当然这个宽度也是和 android:layout_width 配合起来作用的,如果 android:layout_width="fill_parent" 的话,那么设置 android:width 是没有意义的 android:layout_width 其实是可以实现 android:width 的效果的,我觉得这应该是为什么在 android 实例中看不到有人用 android:width 的原因吧…
最近在看android的东西,发现很多和web前台的东西一样(思想).只是看到很多属性的写法和前台有差别,刚刚看到这样的属性: android:width 其实是定义控件上面的文本(TextView) 的宽度,当然这个宽度也是和 android:layout_width 配合起来作用的,如果 android:layout_width="fill_parent" 的话,那么设置 android:width 是没有意义的 android:layout_width 其实是可以实现 andro…
想将LinearLayout作为一个按钮,加上一个动态背景,按下的时候,背景变色,这个理所当然应该使用selector背景选择器来做: <LinearLayout android:id="@+id/btn_user_profit_record" android:layout_width="0dp" android:layout_height="130dp" android:layout_weight="1" androi…
android下优化 清除无效 未被使用的 代码 UCDetector 官方下载地址:http://www.ucdetector.org/index.html UCDetector  是 eclipse 工具 能够审查出程序中  未被使用的. 冗余的. 变量不规范 的代码 须要注意: 反射 .在xml中配置注入方式.第三方project的应用 .jar包调用   等 须要自己手工推断 建议删除类的时候   先全局搜索一下 推断有无其他地方调用     eclipse全局搜索快捷键 (window…