启动预览运行界面时,界面view的传值(内存)方式
- 主要语言
- Java
- 星标
- 4
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
描述
主要思路,通过intent.putExtra(String key,String value);实现内存中传值
关于value使用map变量和ArrayList和json(Gson库)处理
创建布局界面里使用
```
map.put("text","按钮");
map.put("width",-2);
intent.putExtras("layout"),newGson().toJson(ArrayList views))
intent.setClass(Context,sub.class)
startActivity(intent)
```
接收端
```
layout = new Gson().fromJson(getIntent().getStringExtra("layout")
//遍历所有ArrayList 就是获取每一个map元素
//再从每一个map元素中取值(根据key)
//然后动态创建view,动态设置属性,最后添加到布局中去
```
贡献指南
这个仓库没有索引到贡献指南
调研方向
The issue describes passing layout data via Intent extras using Gson serialization of ArrayList. Start by examining the Android Activity lifecycle and Intent handling in the codebase. Look for the sub.class mentioned and see how views are dynamically created. Check if there are existing examples of Gson usage and view inflation. The goal is to implement the described data flow and dynamic UI construction.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- android, java
- 领域
- backend-api-design, mobile
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 40/100