[英]How to include a portrait layout in a landscape layout?
I have designed the perfect portrait layout.我设计了完美的纵向布局。 I'd like to include is as a part of the landscape version (see attachment).
我想将 is 作为横向版本的一部分(见附件)。
There is no extra functionality, so I don't see a need to go to trouble of using Fragments.没有额外的功能,所以我认为没有必要在使用 Fragments 时遇到麻烦。
Of course, one cannot include the portrait version of a layout in the landscape version.当然,不能在横向版本中包含布局的纵向版本。 The following code produces the obvious error of "layouts should not include itself":
以下代码产生“布局不应包含自身”的明显错误:
<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>
Is there a way to force a layout directory so that I don't get this include infinite loop?有没有办法强制布局目录,这样我就不会包含无限循环? Or is there another way altogether?
还是完全有另一种方式? I'd really like to avoid changing any java code at this point!
在这一点上,我真的很想避免更改任何 Java 代码!
Best practice:最佳实践:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.