看起来很简单的一个Python脚本, 把Android的View树从一种格式(文本)转换为xml格式.
从gpt的回答来看, 它应该已经理解了需求, 但几次生成的脚本都不行, 脚本生成的xml完全不对.
源文件格式:
FrameLayout{abc123 V.E...... ...... 0,0-1080,1920}
ViewPagerSpace{def456 F...... ...... 0,0-1080,10}
DesktopContainer{ghi789 V.E...... ...... 0,0-1080,1910}
HomeRecyclerView{jkl012 V.E...... ...... 0,0-1080,1910}
ConstraintLayout{mno345 V.E...... ...... 0,0-1080,400}
ConstraintLayout{pqr678 V.E...... ...... 0,0-1080,400}
TextView{stu901 V.E...... ...... 0,0-200,50 #7f0a004d app:id/title}
TextView{vwx234 V.E...... ...... 0,50-200,100 #7f0a004e app:id/desc}
目标文件格式:
<?xml version="1.0" ?>
<ViewTree>
<FrameLayout flags="V.E......" bounds="0,0 to 1080,1920">
<ViewPagerSpace flags="F......" bounds="0,0 to 1080,10"/>
<DesktopContainer flags="V.E......" bounds="0,0 to 1080,1910">
<HomeRecyclerView flags="V.E......" bounds="0,0 to 1080,1910">
<ConstraintLayout flags="V.E......" bounds="0,0 to 1080,400">
<ConstraintLayout flags="V.E......" bounds="0,0 to 1080,400">
<TextView flags="V.E......" bounds="0,0 to 200,50" id="@0x7f0a004d" name="app:id/title"/>
<TextView flags="V.E......" bounds="0,50 to 200,100" id="@0x7f0a004e" name="app:id/desc"/>
</ConstraintLayout>
</ConstraintLayout>
</HomeRecyclerView>
</DesktopContainer>
</FrameLayout>
</ViewTree>
--
FROM 125.39.236.*