我设计了完美的人像布局。我想将其作为横向版本的一部分(见附件)。
没有额外的功能,所以我认为不需要麻烦使用碎片。
当然,不能在横向版本中包含版面的纵向版本。下面的代码产生了明显的错误:“布局不应该包含自身”:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<include
android:layout_width="wrap_content"
android:layout_height="match_parent"
layout="@layout/my_perfect_layout"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/demo"
/>
</LinearLayout>
有没有办法强制布局目录,以便我不会得到这包括无限循环?或者还有另一种方式吗?我真的想避免在此时更改任何java代码!
答案 0 :(得分:1)
最佳实践: