【发布时间】:2015-08-31 14:52:17
【问题描述】:
我正在做一个 Android 用户界面。 我的想法是将这个界面分成三个相等的部分(这很简单,三个有重量的布局),但我想在这些布局的交互中放置一个图像。 例如,在 layout1 和 layout2 中重叠了一些空间的图像,在 2 和 3 中是相同的。
如何做到这一点?我的代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1.0">
<LinearLayout
android:id="@+id/first"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.33">
</LinearLayout>
<LinearLayout
android:id="@+id/second"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.33"></LinearLayout>
<LinearLayout
android:id="@+id/third"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.33"></LinearLayout>
</LinearLayout>
还有我的想法:Android: Placing ImageView on overlap between layouts 谢谢
【问题讨论】:
-
你想把 Imageview 放在哪里?在第一个 LinearLayout 上,不是吗?
-
我觉得你需要使用 PercentageRelativeLayout developer.android.com/reference/android/support/percent/…