【发布时间】:2017-03-07 10:28:07
【问题描述】:
我为我的应用创建了一个好看的布局,但我在线性布局中使用了相对布局(根据我的需要)。
这样好吗?我的团队伙伴告诉我,这不符合 android 指南,这会使应用在搜索中失败。
所以基本上,对于我们应该如何使用布局以及当应用在 Play 商店中时 Google 是否会监控这些代码,是否有任何限制。
这是代码(修改后必须放入)
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bio2"
android:layout_below="@+id/bio1"
android:orientation="horizontal"
android:layout_marginTop="15dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sagar Vakkala"
android:textStyle="bold"
android:textColor="#000"
android:id="@+id/namebio"
android:layout_marginLeft="15sp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/namebio"
android:textStyle="normal"
android:text="From Delhi to Chennai in a whiff :)"
android:textColor="#000"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
/>
</RelativeLayout>
</LinearLayout>
【问题讨论】:
-
没有这样的限制..
-
嵌套布局不利于性能。您可以利用RelativeLayout
relativity并摆脱容器。 -
我认为他们不会根据布局静态文件对应用程序进行排名,尽管它们可能会超过性能排名。别担心。随着时间的推移,您将学习如何优化布局并摆脱无用的 ViewGroup。
-
你的队友完全错了:)
-
还是没有得到明确的答案:(
标签: android xml user-interface user-experience design-guidelines