Android Editview lineSpacingExtra (行间距) 失效问题。
2017-03-23 17:46
836 查看
在某些机型上lineSpacing 初始化正常。 编辑时lineSpacing 设置直接消失。
stackoverflow 上查了发现。 此为系统BUG。 只有在5.0以上某些机型出现。
解决方案
stackoverflow 上查了发现。 此为系统BUG。 只有在5.0以上某些机型出现。
解决方案
/** * Created by 4399-1500 on 2017/3/22. */ public class AutoLineEditText extends EditText { public AutoLineEditText(Context context) { super(context); } public AutoLineEditText(Context context, AttributeSet attrs) { super(context, attrs); } public AutoLineEditText(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); } @Override protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) { if (lengthBefore != lengthAfter) { int startSelection = getSelectionStart(); setText(text); setSelection(startSelection); } } }
相关文章推荐
- Android TextView 设置行间距的问题 (setLineSpacing ,lineSpacingExtra, lineSpacingMultiplier)
- 填填Android lineSpacingExtra 的坑,解决行间距兼容性问题
- Android WebView点击EditText时整体被拉伸变大问题的解决
- ListView与GridView的item中使用ImageView的android:scaleType属性失效问题
- android TextView setSingleLinexia显示问题
- 【转】android去掉EditView的默认焦点问题
- 关于设置android中EditView控件是否可编辑的相关问题
- 解决Android下ViewPager和PagerAdapter中调用notifyDataSetChanged失效问题
- android listview editview冲突问题
- 关于android:lineSpacingExtra属性 在android5.0与之前版本存在的区别
- Android EditView 开发中遇到的问题(未完善)
- android EditView的一些问题
- android 关于EditView 输入问题
- 解决android的EditView输入问题
- 关于Android:lineSpacingExtra属性在Android5.0与之前版本存在的区别
- Android中findViewById()h获取EditText 空指针问题
- 解决android的EditView输入问题(这篇装载的blog有错误)
- 关于android webview js桥(addJavascriptInterface) 失效的问题
- 有关ViewPager的使用及解决Android下ViewPager和PagerAdapter中调用notifyDataSetChanged失效的问题
- android:lineSpacingExtra,android:lineSpacingMultiplie