Extract Support Library layout attributes into styles

不羁岁月 提交于 2019-12-20 00:20:14

问题


I am extracting styles for views which are inside Support Library's GridLayout.

Therefore, I have both attributes from the "android" namespace, e.g. android:layout_marginLeft="8dp" and attributes from the "app" (http://schemas.android.com/apk/res-auto) one, e.g. app:layout_columnSpan="2".

First, Android Studio doesn't recognize the attributes from "app" when I try to extract the attributes as a style. Second, it doesn't seem that extracting them into styles.xml manually brings any effect to the actual layout. So, is it possible to extract the Support Library attributes as a separate style, and how?


回答1:


I have found this answer to a similar question. The same solution worked for me.

Just leave out the namespace prefix for the non-"android" attributes:

app:layout_columnSpan="2" in the layout becomes

<item name="layout_columnSpan">2</item> in the styles, and not

<item name="app:layout_columnSpan">2</item>



来源:https://stackoverflow.com/questions/20990338/extract-support-library-layout-attributes-into-styles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!