我想解決的問題是,如果android有類似於ASP.Net中的masterpages,或者流星的IronRouter中的{{> yield}}模板。Android模板類似ASP.net Masterpages的東西?
本質上我想要的是能夠定義一個模板並指定xml構造中的內容。
想象一個簡單的卡片控件,其中的內容是在設計時在xml中指定的。
也許定義控制是這樣的:
<myCardControl>
<layout>
<text />
<content />
<button />
</layout>
</myCardControl>
,然後用它在其他佈局像一個組件:
<layout>
<myCardControl>
<image />
</myCardControl>
<myCardControl>
<image />
</myCardControl>
<myCardControl>
<layout>
<text>...or other controls etc.
</layout>
</myCardControl>
</layout>
如果有人能理解我在說什麼,你可以點我在正確的方向。我是Android開發人員的新手,並且正在制定最佳做法。我環顧四周,但無法找到答案。
感謝您的反應,我非常瞭解這些代碼中的方法,我真的在尋找一個XML答案。你說現在還沒有辦法,所以我想這就是答案。 – Shane