[英]Is it okay to use the same layout for two different activities?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="92dp"
android:text="Start Download" />
</LinearLayout>
这两个活动必须执行相同的操作。唯一的区别是它们处理的数据类型。 只是出于好奇,我问这个问题。
是的,这在技术上没有问题。 请记住,如果您为一项活动更改任何内容,则两者都会更改,因此它最适合非常简单的布局。 但我经常会为 4 或 5 个尚未编写的活动使用相同的占位符,或者我会为占位符列表视图元素使用相同的布局。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.