简体   繁体   English

如何在Android中以编程方式将样式和主题设置为linearlayout?

[英]How can I set Styles and Themes to linearlayout, programmatically in android?

如何在Android中以编程方式将Styles和Themes设置为linearlayout?

You can implement it by using a dynamic structure where all the designing info will come from server 您可以使用动态结构来实现它,其中所有设计信息都将来自服务器

  1. For that you have to create a xml having list of themes what names you required to give associated with an id. 为此,您必须创建一个具有主题列表的xml,您需要提供与ID相关联的名称。
  2. Parse xml and show its content to a list then at selection of an item of list save id associated with it in your shared preferences. 解析xml并将其内容显示到列表中,然后在选择一个列表项时将与之关联的ID保存在共享首选项中。
  3. Each time when the designing part will be loaded you will send id with it as http://xyz.abc.com/images/menu-images/your_id which will respond you with an image or design info related to that theme id. 每次加载设计零件时,您都会将其ID发送为http://xyz.abc.com/images/menu-images/your_id ,它将为您提供与该主题ID相关的图像或设计信息。
  4. To save downloading each time of content indroduce a check that if value saved in preferences then use existing image saved or cached in application. 为了节省每次内容下载的时间,请检查一下是否将值保存在首选项中,然后使用保存或缓存在应用程序中的现有图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Android中以编程方式将TextView设置为LinearLayout? - How can I set TextView into LinearLayout programmatically in Android? 如何在Android中以编程方式将LinearLayout设置为另一个LinearLayout? - How can i set LinearLayout into another LinearLayout programatically in android? 如何在Android中命名样式和主题 - How should I name styles and Themes in Android Android - 如何在 Linearlayout 中以编程方式设置按钮样式? - Android - How to programmatically set the button style in a Linearlayout? Android:如何以编程方式设置LinearLayout marging - Android: How to set LinearLayout marging programmatically 以编程方式访问Android中的主题/样式/ attrs - Programmatically accessing themes/styles/attrs in Android 在哪里可以查看 Android Studio 主题和 styles 的示例? - Where can I view examples of the Android Studio themes and styles? 我在哪里可以找到 android 主题/样式之间的差异? - Where can I find out the differences between themes/styles for android? 如何再次将以编程方式创建的linearlayout添加到另一个linearlayout - How can I add again a programmatically created linearlayout to another linearlayout 如何以编程方式将图像添加到LinearLayout? - How can I add images to a LinearLayout programmatically?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM