安卓自定义属性,Android studio无法提示,只提示3个
只提示三个属性:
lvzhongyi:paddingEnd="" lvzhongyi:paddingStart="" lvzhongyi:android:focusable=""
解决:把styleable里面的名称跟自定义View的类名写成一样:
attrs.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <attr name="MyText" format="string"/> <attr name="MyTextColor" format="color"/> <attr name="MyTextSize" format="dimension"/> <declare-styleable name="MyView"> <attr name="MyText"/> <attr name="MyTextColor"/> <attr name="MyTextSize"/> </declare-styleable> </resources>
MyView.java
public class MyView extends View {}