【发布时间】:2018-06-18 17:51:43
【问题描述】:
我得到了以下活动
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:background="@color/colorGray"
tools:context=".ProductsActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/navigation"
app:layout_constraintTop_toTopOf="parent"></LinearLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="?android:attr/windowBackground"
app:itemIconTint="@drawable/btv_tab_item_foreground"
app:itemTextColor="@drawable/btv_tab_item_foreground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation" />
</android.support.constraint.ConstraintLayout>
在我的 LinearLayout 中,我想添加 6 个文本视图或按钮或任何我想要它们的东西
- 宽度等于父级宽度
- 高度,彼此相等
类似于上图(线条未正确调整,因为它们是使用 MS Paint 绘制的)。但我认为你明白了。
【问题讨论】:
-
their height perfectly adjusted to their parent's constraint height,这是否意味着您希望它们的宽度与父级相等且高度彼此相等? -
是的。但占据其父级的所有可用高度