【发布时间】:2018-05-23 13:07:26
【问题描述】:
我想把这两个部分放在一个布局中,形成一个加载栏。
和
橙色指示器需要在木板里面, 但我找不到以正确方式连接它们的方法......
最终结果应如下所示
.
XML 文件:
<android.support.constraint.ConstraintLayout
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="match_parent">
<ImageView
android:id="@+id/wood_board"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.menwithandroid.myhookah.gui.LoadingProgressBar
android:id="@+id/loading_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.constraint.ConstraintLayout>
如何正确连接这些部分? 谢谢。
【问题讨论】:
-
你可以使用RelativeLayout轻松实现这一点,给视图提供相同的关系,但问题是你想做什么?我的意思是你想在图像视图上显示加载器吗?
-
指示器应该在插座内(在木板上),所以我需要应用边距或其他值来确定它的位置。但我不能使用 dp 或 px 因为它会在其他屏幕尺寸上被搞砸......
-
拥有相同比例的图像..意味着橙色部分在这种方式周围具有必要的透明空间,只需将它们放在同一个父视图中
标签: android android-layout android-view android-gui