开发者

Android: Create a layout file containing unbound elements

All layout files I've seen contain some outer bounding element such as LinearLayout. I would like to create a layout file that does not contain any bounding elements. For example, all I want is to have a TextView and nothing else. I then load this in code and insert it into an existing View. Without an outer bounding element, the app will not compile. Is there some kind of outer bound element I can use that acts as 开发者_如何学运维a plain vanilla container with no properties? If you use LinearLayout, it will end up generating unnecessary code that my View does not require.


Have you remembered to set the namespace of the element? The root element of any layout you declare must have this: xmlns:android="http://schemas.android.com/apk/res/android"

Also, when you have a problem like this, it will be infinitely easier to help you if you include the code in your question.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜