我正在使用ConstraintLayout
制作应用。但是,当我添加工具栏时,它会重叠其他组件。我为此目的使用约束布局我已经看到了其他问题,但他们没有使用ConstraintLayout
。
我ConstraintLayout
中是否遗漏了某些内容,因为有关SO的所有其他问题都在使用CoordinatorLayout
toolbar.xml
<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.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
mainactiivity.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:fillViewport="true"
android:fitsSystemWindows="true"
xmlns:android="http://schemas.android.com/apk/res/android" >
<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"
tools:context=".Work">
<include layout="@layout/activity_toolbar"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
<EditText
android:id="@+id/inputfrom"
android:layout_width="156dp"
android:layout_height="45dp"
android:layout_marginBottom="18dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="From"
android:inputType="textEmailAddress"
android:singleLine="true"
app:layout_constraintBottom_toTopOf="@+id/texttypetravel"
app:layout_constraintEnd_toStartOf="@+id/inpuTo"
app:layout_constraintHorizontal_bias="0.571"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<EditText
android:id="@+id/inpuTo"
android:layout_width="190dp"
android:layout_height="47dp"
android:layout_marginBottom="182dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:ems="10"
android:hint="Destination"
android:inputType="textPersonName"
android:singleLine="true"
app:layout_constraintBottom_toTopOf="@+id/imageView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/texttypetravel"
android:layout_width="102dp"
android:layout_height="0dp"
android:layout_marginBottom="455dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:text="Work"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/spinner"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inputfrom" />
<Spinner
android:id="@+id/spinner"
android:layout_width="236dp"
android:layout_height="22dp"
android:layout_marginBottom="24dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
app:layout_constraintBottom_toTopOf="@+id/inputdescription"
app:layout_constraintEnd_toEndOf="parent" />
<EditText
android:id="@+id/inputdescription"
android:layout_width="310dp"
android:layout_height="wrap_content"
android:layout_marginBottom="119dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="130dp"
android:ems="10"
android:hint="Work Description"
android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/checkBoxTrain"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread_inside" />
<CheckBox
android:id="@+id/checkBoxExpense"
android:layout_width="146dp"
android:layout_height="32dp"
android:layout_marginBottom="28dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:text="Expense Given"
android:onClick="enable"
app:layout_constraintBottom_toTopOf="@+id/checkBoxpass"
app:layout_constraintEnd_toStartOf="@+id/inputExpenseGiven"
app:layout_constraintStart_toStartOf="parent" />
<EditText
android:id="@+id/inputExpenseGiven"
android:layout_width="195dp"
android:layout_height="45dp"
android:layout_marginBottom="44dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:ems="10"
android:hint="Amount"
android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/inputamount1"
app:layout_constraintEnd_toEndOf="parent" />
<CheckBox
android:id="@+id/checkBoxpass"
android:layout_width="109dp"
android:layout_height="30dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_marginStart="16dp"
android:text="Pass Taken"
android:onClick="passtaken"
app:layout_constraintBottom_toTopOf="@+id/checkBoxTrain"
app:layout_constraintEnd_toStartOf="@+id/imageView"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" />
<CheckBox
android:id="@+id/checkBoxTrain"
android:layout_width="109dp"
android:layout_height="0dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:text="Train"
android:onClick="train"
app:layout_constraintBottom_toTopOf="@+id/inputamount2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inputdescription" />
<CheckBox
android:id="@+id/checkBoxBus"
android:layout_width="109dp"
android:layout_height="30dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="Bus"
android:onClick="bus"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBoxTrain" />
<CheckBox
android:id="@+id/checkBoxBike"
android:layout_width="109dp"
android:layout_height="30dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:text="Bike"
android:onClick="bikeEnable"
app:layout_constraintEnd_toStartOf="@+id/inputamount3"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBoxBus" />
<CheckBox
android:id="@+id/checkBoxShareRickShaw"
android:layout_width="109dp"
android:layout_height="32dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:onClick="shareRickshaw"
android:text="Share RickShaw"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBoxBike" />
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:onClick="passgiven"
android:maxWidth="30dip"
android:maxHeight="50dip"
android:scaleType="centerCrop"
android:adjustViewBounds ="true"
app:layout_constraintBottom_toTopOf="@+id/imageView2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/inputamount1"
app:layout_constraintTop_toBottomOf="@+id/inpuTo"
app:srcCompat="@drawable/ic_camera_alt_black_24dp" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="33dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:onClick="trainticketimage"
android:maxWidth="30dip"
android:scaleType="centerCrop"
android:adjustViewBounds ="true"
app:layout_constraintBottom_toTopOf="@+id/imageView3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/inputamount2"
app:layout_constraintTop_toBottomOf="@+id/imageView"
app:srcCompat="@drawable/ic_camera_alt_black_24dp" />
<EditText
android:id="@+id/inputamount1"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_marginEnd="44dp"
android:layout_marginRight="44dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/inputamount2"
app:layout_constraintEnd_toStartOf="@+id/imageView2" />
<EditText
android:id="@+id/inputamount2"
android:layout_width="146dp"
android:layout_height="48dp"
android:layout_marginEnd="68dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="68dp"
android:layout_marginStart="8dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/inputamount3"
app:layout_constraintEnd_toStartOf="@+id/imageView3"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/checkBoxBus"
app:layout_constraintTop_toBottomOf="@+id/checkBoxTrain" />
<EditText
android:id="@+id/inputamount3"
android:layout_width="140dp"
android:layout_height="47dp"
android:layout_marginEnd="100dp"
android:layout_marginRight="100dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/inputamount4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inputamount2" />
<EditText
android:id="@+id/inputamount4"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_marginBottom="58dp"
android:layout_marginEnd="100dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="100dp"
android:layout_marginStart="8dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/btn_submit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.272"
app:layout_constraintStart_toEndOf="@+id/checkBoxShareRickShaw"
app:layout_constraintTop_toBottomOf="@+id/inputamount3" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="199dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:maxWidth="30dip"
android:scaleType="centerCrop"
android:layout_marginStart="8dp"
android:onClick="busticketimage"
android:adjustViewBounds ="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/inputamount3"
app:layout_constraintTop_toBottomOf="@+id/imageView2"
app:srcCompat="@drawable/ic_camera_alt_black_24dp" />
<Button
android:id="@+id/btn_submit"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="145dp"
android:layout_height="0dp"
android:layout_marginEnd="80dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="80dp"
android:layout_marginStart="8dp"
android:onClick="submit_btn"
android:text="Submit"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/textfinalamount"
app:layout_constraintHorizontal_bias="0.229"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inputamount4" />
<TextView
android:id="@+id/textfinalamount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/textAvailableBalance"
android:layout_width="187dp"
android:layout_height="27dp"
android:layout_marginTop="20dp"
android:text="Available Balance"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.081"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inputamount4" />
<TextView
android:id="@+id/textAvailableBalance1"
android:layout_width="95dp"
android:layout_height="26dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:text="3000"
app:layout_constraintBottom_toTopOf="@+id/btn_submit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.514"
app:layout_constraintStart_toEndOf="@+id/textAvailableBalance" />
<TextView
android:id="@+id/textbalanceused"
android:layout_width="83dp"
android:layout_height="21dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="Used Money"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/textfinalamount"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/btn_submit"
app:layout_constraintTop_toBottomOf="@+id/textAvailableBalance1"
app:layout_constraintVertical_bias="1.0" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
答案 0 :(得分:1)
您应该从inputform和inputo中删除app:layout_constraintTop_toTopOf="parent"
,并在两者中添加app:layout_constraintTop_toBottomOf="@+id/toolbar"
。
尝试以下代码
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:fillViewport="true"
android:fitsSystemWindows="true"
xmlns:android="http://schemas.android.com/apk/res/android" >
<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"
tools:context=".Work">
<include
android:id="@+id/toolbar"
layout="@layout/activity_toolbar"
android:layout_width="match_parent"
android:layout_height="50dp" />
<EditText
android:id="@+id/inputfrom"
android:layout_width="156dp"
android:layout_height="45dp"
android:layout_marginBottom="18dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:ems="10"
android:hint="From"
android:inputType="textEmailAddress"
android:singleLine="true"
app:layout_constraintBottom_toTopOf="@+id/texttypetravel"
app:layout_constraintEnd_toStartOf="@+id/inpuTo"
app:layout_constraintHorizontal_bias="0.571"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar" />
<EditText
android:id="@+id/inpuTo"
android:layout_width="190dp"
android:layout_height="47dp"
android:layout_marginBottom="182dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:ems="10"
android:hint="Destination"
android:inputType="textPersonName"
android:singleLine="true"
app:layout_constraintBottom_toTopOf="@+id/imageView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/texttypetravel"
android:layout_width="102dp"
android:layout_height="0dp"
android:layout_marginBottom="455dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:text="Work"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/spinner"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inputfrom" />
<Spinner
android:id="@+id/spinner"
android:layout_width="236dp"
android:layout_height="22dp"
android:layout_marginBottom="24dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
app:layout_constraintBottom_toTopOf="@+id/inputdescription"
app:layout_constraintEnd_toEndOf="parent" />
<EditText
android:id="@+id/inputdescription"
android:layout_width="310dp"
android:layout_height="wrap_content"
android:layout_marginBottom="119dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="130dp"
android:ems="10"
android:hint="Work Description"
android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/checkBoxTrain"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="spread_inside" />
<CheckBox
android:id="@+id/checkBoxExpense"
android:layout_width="146dp"
android:layout_height="32dp"
android:layout_marginBottom="28dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:text="Expense Given"
android:onClick="enable"
app:layout_constraintBottom_toTopOf="@+id/checkBoxpass"
app:layout_constraintEnd_toStartOf="@+id/inputExpenseGiven"
app:layout_constraintStart_toStartOf="parent" />
<EditText
android:id="@+id/inputExpenseGiven"
android:layout_width="195dp"
android:layout_height="45dp"
android:layout_marginBottom="44dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:ems="10"
android:hint="Amount"
android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/inputamount1"
app:layout_constraintEnd_toEndOf="parent" />
<CheckBox
android:id="@+id/checkBoxpass"
android:layout_width="109dp"
android:layout_height="30dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_marginStart="16dp"
android:text="Pass Taken"
android:onClick="passtaken"
app:layout_constraintBottom_toTopOf="@+id/checkBoxTrain"
app:layout_constraintEnd_toStartOf="@+id/imageView"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" />
<CheckBox
android:id="@+id/checkBoxTrain"
android:layout_width="109dp"
android:layout_height="0dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:text="Train"
android:onClick="train"
app:layout_constraintBottom_toTopOf="@+id/inputamount2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inputdescription" />
<CheckBox
android:id="@+id/checkBoxBus"
android:layout_width="109dp"
android:layout_height="30dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="Bus"
android:onClick="bus"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBoxTrain" />
<CheckBox
android:id="@+id/checkBoxBike"
android:layout_width="109dp"
android:layout_height="30dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:text="Bike"
android:onClick="bikeEnable"
app:layout_constraintEnd_toStartOf="@+id/inputamount3"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBoxBus" />
<CheckBox
android:id="@+id/checkBoxShareRickShaw"
android:layout_width="109dp"
android:layout_height="32dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="12dp"
android:onClick="shareRickshaw"
android:text="Share RickShaw"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/checkBoxBike" />
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:onClick="passgiven"
android:maxWidth="30dip"
android:maxHeight="50dip"
android:scaleType="centerCrop"
android:adjustViewBounds ="true"
app:layout_constraintBottom_toTopOf="@+id/imageView2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/inputamount1"
app:layout_constraintTop_toBottomOf="@+id/inpuTo"
app:srcCompat="@drawable/ic_camera_alt_black_24dp" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="33dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:onClick="trainticketimage"
android:maxWidth="30dip"
android:scaleType="centerCrop"
android:adjustViewBounds ="true"
app:layout_constraintBottom_toTopOf="@+id/imageView3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/inputamount2"
app:layout_constraintTop_toBottomOf="@+id/imageView"
app:srcCompat="@drawable/ic_camera_alt_black_24dp" />
<EditText
android:id="@+id/inputamount1"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_marginEnd="44dp"
android:layout_marginRight="44dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/inputamount2"
app:layout_constraintEnd_toStartOf="@+id/imageView2" />
<EditText
android:id="@+id/inputamount2"
android:layout_width="146dp"
android:layout_height="48dp"
android:layout_marginEnd="68dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="68dp"
android:layout_marginStart="8dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/inputamount3"
app:layout_constraintEnd_toStartOf="@+id/imageView3"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/checkBoxBus"
app:layout_constraintTop_toBottomOf="@+id/checkBoxTrain" />
<EditText
android:id="@+id/inputamount3"
android:layout_width="140dp"
android:layout_height="47dp"
android:layout_marginEnd="100dp"
android:layout_marginRight="100dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/inputamount4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inputamount2" />
<EditText
android:id="@+id/inputamount4"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_marginBottom="58dp"
android:layout_marginEnd="100dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="100dp"
android:layout_marginStart="8dp"
android:ems="10"
android:inputType="textPersonName"
app:layout_constraintBottom_toTopOf="@+id/btn_submit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.272"
app:layout_constraintStart_toEndOf="@+id/checkBoxShareRickShaw"
app:layout_constraintTop_toBottomOf="@+id/inputamount3" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="199dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:maxWidth="30dip"
android:scaleType="centerCrop"
android:layout_marginStart="8dp"
android:onClick="busticketimage"
android:adjustViewBounds ="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/inputamount3"
app:layout_constraintTop_toBottomOf="@+id/imageView2"
app:srcCompat="@drawable/ic_camera_alt_black_24dp" />
<Button
android:id="@+id/btn_submit"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="145dp"
android:layout_height="0dp"
android:layout_marginEnd="80dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="80dp"
android:layout_marginStart="8dp"
android:onClick="submit_btn"
android:text="Submit"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/textfinalamount"
app:layout_constraintHorizontal_bias="0.229"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inputamount4" />
<TextView
android:id="@+id/textfinalamount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<TextView
android:id="@+id/textAvailableBalance"
android:layout_width="187dp"
android:layout_height="27dp"
android:layout_marginTop="20dp"
android:text="Available Balance"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.081"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/inputamount4" />
<TextView
android:id="@+id/textAvailableBalance1"
android:layout_width="95dp"
android:layout_height="26dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:text="3000"
app:layout_constraintBottom_toTopOf="@+id/btn_submit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.514"
app:layout_constraintStart_toEndOf="@+id/textAvailableBalance" />
<TextView
android:id="@+id/textbalanceused"
android:layout_width="83dp"
android:layout_height="21dp"
android:layout_marginBottom="16dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="Used Money"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/textfinalamount"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/btn_submit"
app:layout_constraintTop_toBottomOf="@+id/textAvailableBalance1"
app:layout_constraintVertical_bias="1.0" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
答案 1 :(得分:0)
您的inputFrom和工具栏都有约束app:layout_constraintTop_toTopOf =“parent”,它们都有相同的父级。尝试将inputFrom转到工具栏的底部。