java - Does Android studio layout editor shows custom view properties? -
i have compound view consists of 2 buttons , 1 text view. want edit properties of these child views in android studio layout editor can't. shows basic properties no properties of custom view.
does android studio layout editor shows limited number of properties set default? possible edit properties of custom view there, without manually editing xml files?
thanks in advance!!
as described in http://developer.android.com/training/custom-views/create-view.html#customattr have add new ressource (res/values/attrs.xml).
<resources> <declare-styleable name="piechart"> <attr name="showtext" format="boolean" /> <attr name="labelposition" format="enum"> <enum name="left" value="0"/> <enum name="right" value="1"/> </attr> </declare-styleable> </resources>
within view have reference new ressource
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res/com.example.customviews"> <com.example.customviews.charting.piechart custom:showtext="true" custom:labelposition="left" /> </linearlayout>
now should see properties in editor.
Comments
Post a Comment