开发者

Android xml layout and adding a custom view written in xml

I've created a custom view XM开发者_如何学CL layout resource MyView.xml. Can I refer to MyView by the XML layout file inside a second XML layout such as main.xml? If so, how?

(To be clear, I'm not looking for replies that explain how to inflate views from within my Java code, or that explain introducing Java classes in XML layout resources with <com.MyDomain.App.MyView ...> unless this helps here or to clarify that I have no other option.)


If your XML file is like /res/layout/MyView.xml you can refer to in main.xml with

<?xml version=”1.0” encoding=”utf-8”?>

...

<include layout="@layout/MyView.xml" />

...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜