gpt4 book ai didi

android - 如果 fill_parent 已过期,为什么 "android create project"会给出一个带有 fill_parent 而不是 match_parent 的 main.xml?

转载 作者:行者123 更新时间:2023-11-30 02:43:24 26 4
gpt4 key购买 nike

如果 fill_parent 已过期,为什么 android 创建项目,给一个带有 fill_parent 而不是 match_parent 的 main.xml?

我读过很多次,您应该使用 match_parent,而不是 fill_parent。

但是我在执行 android create project 命令时看到了

c:\androidsdktools\sdk\platform-tools>android create project --activity acto --p
ackage a.b.c --target "android-20" --path c:\bleeeeh

查看它生成的 main.xml

我看到使用了 fill_parent,而不是 match_parent。

但这是我下载的最新的android sdk。

c:\bleeeeh\res\layout>type main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout ..........
..........
android:layout_width="fill_parent"
........
</LinearLayout>

c:\bleeeeh\res\layout>

只是为了表明这是撰写本文时最新的 android sdk..2014 年 7 月下载。Android-20

c:\androidsdktools\sdk\platforms>dir /ad
....
25/07/2014 09:56 AM <DIR> android-20
31/07/2014 10:32 PM <DIR> android-L
....
c:\androidsdktools\sdk\platforms>

虽然我什至从 2012 年就看到帖子说不应该使用 fill_parent,但应该使用 match_parent。

那么,为什么android在main.xml中使用fill_parent来创建项目呢?

最佳答案

So, why is android create project using fill_parent in main.xml?

首先,fill_parent 工作正常。虽然 match_parent 是官方首选值,但它映射到与 fill_parent 相同的行为。

其次,android create project使用的项目模板对于Android工具团队来说并不是特别高的优先级,很大程度上是因为android与 Android Studio 和 Eclipse 相比,create project 工具本身对于 Android 工具团队来说并不是特别重要的优先级。我预计 android create project 将在适当的时候完全停止或被其他东西取代。

如果您愿意,欢迎您修改布局文件以使用 match_parent

请记住,android create project 旨在创建使用 Ant 构建工具构建的项目,而对 Ant 的支持正在迅速消失。如果您不想,可以不必使用 IDE,但您应该考虑在不久之后迁移到 Gradle for Android。

关于android - 如果 fill_parent 已过期,为什么 "android create project"会给出一个带有 fill_parent 而不是 match_parent 的 main.xml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25455066/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com