2017-03-07 81 views
1
<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="com.code.zero.drivermechanicsapp.AccidentAlertFragment"> 

<!-- TODO: Update blank fragment layout --> 


<TextView 
    android:text="Report Road Incident" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView2" 
    android:layout_marginTop="16dp" 
    app:layout_constraintTop_toTopOf="parent" 
    tools:text="Report Road Incident" 
    android:layout_marginStart="16dp" 
    app:layout_constraintLeft_toLeftOf="parent" 
    android:layout_marginLeft="16dp" 
    android:layout_marginEnd="16dp" 
    app:layout_constraintRight_toRightOf="parent" 
    android:layout_marginRight="16dp" 
    android:textSize="18sp" 
    android:textStyle="bold"/> 

<TextView 
    android:text="Concern" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView3" 
    android:layout_marginStart="16dp" 
    app:layout_constraintLeft_toLeftOf="parent" 
    android:layout_marginLeft="16dp" 
    tools:text="Concern" 
    app:layout_constraintTop_toTopOf="@+id/editText" /> 

<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="textPersonName" 
    android:ems="10" 
    android:id="@+id/editText" 
    android:layout_marginStart="120dp" 
    app:layout_constraintLeft_toLeftOf="parent" 
    android:layout_marginLeft="120dp" 
    android:layout_marginTop="64dp" 
    app:layout_constraintTop_toBottomOf="@+id/textView2" /> 

<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="textPersonName" 
    android:ems="10" 
    android:id="@+id/editText2" 
    app:layout_constraintLeft_toLeftOf="@+id/editText" 
    android:layout_marginTop="8dp" 
    app:layout_constraintTop_toBottomOf="@+id/editText" /> 

<TextView 
    android:text="Where" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView5" 
    tools:text="Where" 
    app:layout_constraintTop_toTopOf="@+id/editText2" 
    app:layout_constraintLeft_toLeftOf="@+id/textView3" /> 

<TextView 
    android:text="Description" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView6" 
    tools:text="Description" 
    app:layout_constraintLeft_toLeftOf="@+id/textView5" 
    app:layout_constraintTop_toTopOf="@+id/editText4" 
    android:minLines="3" 
    android:maxLines="5"/> 

<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="textMultiLine" 
    android:ems="10" 
    android:id="@+id/editText4" 
    android:layout_marginTop="8dp" 
    app:layout_constraintTop_toBottomOf="@+id/editText2" 
    app:layout_constraintLeft_toLeftOf="@+id/editText2" 
    android:maxLines="5" 
    android:minLines="3" /> 

<Button 
    android:text="Send S.O.S." 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:id="@+id/button" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintHorizontal_bias="1.0" 
    app:layout_constraintBottom_toBottomOf="parent" /> 

<TextView 
    android:text="Phone" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView21" 
    app:layout_constraintLeft_toLeftOf="@+id/textView6" 
    app:layout_constraintTop_toTopOf="@+id/editText3" /> 

<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="phone" 
    android:ems="10" 
    android:id="@+id/editText3" 
    android:layout_marginTop="8dp" 
    app:layout_constraintTop_toBottomOf="@+id/editText4" 
    app:layout_constraintLeft_toLeftOf="@+id/editText4" /> 

如何滚动我的屏幕

因为我键入它会挡住屏幕。我什至不知道即时打字。 和我在这个android开发中真的很新。我不知道该怎么办。 你能帮我解决这个问题吗?

因为我键入它会阻止屏幕。我什至不知道即时打字。 和我在这个android开发中真的很新。我不知道该怎么办。 你能帮我解决这个问题吗?

回答

0

把你的意见,滚动型象下面这样:

<FrameLayout 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" 

    > 

    <ScrollView 
     android:id="@+id/scrollView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 


     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 
<TextView 
    android:text="Report Road Incident" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView2" 
    android:layout_marginTop="16dp" 
    app:layout_constraintTop_toTopOf="parent" 
    tools:text="Report Road Incident" 
    android:layout_marginStart="16dp" 
    app:layout_constraintLeft_toLeftOf="parent" 
    android:layout_marginLeft="16dp" 
    android:layout_marginEnd="16dp" 
    app:layout_constraintRight_toRightOf="parent" 
    android:layout_marginRight="16dp" 
    android:textSize="18sp" 
    android:textStyle="bold"/> 

<TextView 
    android:text="Concern" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView3" 
    android:layout_marginStart="16dp" 
    app:layout_constraintLeft_toLeftOf="parent" 
    android:layout_marginLeft="16dp" 
    tools:text="Concern" 
    app:layout_constraintTop_toTopOf="@+id/editText" /> 

<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="textPersonName" 
    android:ems="10" 
    android:id="@+id/editText" 
    android:layout_marginStart="120dp" 
    app:layout_constraintLeft_toLeftOf="parent" 
    android:layout_marginLeft="120dp" 
    android:layout_marginTop="64dp" 
    app:layout_constraintTop_toBottomOf="@+id/textView2" /> 

<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="textPersonName" 
    android:ems="10" 
    android:id="@+id/editText2" 
    app:layout_constraintLeft_toLeftOf="@+id/editText" 
    android:layout_marginTop="8dp" 
    app:layout_constraintTop_toBottomOf="@+id/editText" /> 

<TextView 
    android:text="Where" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView5" 
    tools:text="Where" 
    app:layout_constraintTop_toTopOf="@+id/editText2" 
    app:layout_constraintLeft_toLeftOf="@+id/textView3" /> 

<TextView 
    android:text="Description" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView6" 
    tools:text="Description" 
    app:layout_constraintLeft_toLeftOf="@+id/textView5" 
    app:layout_constraintTop_toTopOf="@+id/editText4" 
    android:minLines="3" 
    android:maxLines="5"/> 

<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="textMultiLine" 
    android:ems="10" 
    android:id="@+id/editText4" 
    android:layout_marginTop="8dp" 
    app:layout_constraintTop_toBottomOf="@+id/editText2" 
    app:layout_constraintLeft_toLeftOf="@+id/editText2" 
    android:maxLines="5" 
    android:minLines="3" /> 

<Button 
    android:text="Send S.O.S." 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:id="@+id/button" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintHorizontal_bias="1.0" 
    app:layout_constraintBottom_toBottomOf="parent" /> 

<TextView 
    android:text="Phone" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView21" 
    app:layout_constraintLeft_toLeftOf="@+id/textView6" 
    app:layout_constraintTop_toTopOf="@+id/editText3" /> 

<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="phone" 
    android:ems="10" 
    android:id="@+id/editText3" 
    android:layout_marginTop="8dp" 
    app:layout_constraintTop_toBottomOf="@+id/editText4" 
    app:layout_constraintLeft_toLeftOf="@+id/editText4" /> 
</LinearLayout> 
    </ScrollView> 

</FrameLayout> 
0

要滚动屏幕,你只需要简单地做放滚动型布局内,这样的:

<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="com.code.zero.drivermechanicsapp.AccidentAlertFragment"> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

<TextView 
    android:text="Report Road Incident" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView2" 
    android:layout_marginTop="16dp" 
    app:layout_constraintTop_toTopOf="parent" 
    tools:text="Report Road Incident" 
    android:layout_marginStart="16dp" 
    app:layout_constraintLeft_toLeftOf="parent" 
    android:layout_marginLeft="16dp" 
    android:layout_marginEnd="16dp" 
    app:layout_constraintRight_toRightOf="parent" 
    android:layout_marginRight="16dp" 
    android:textSize="18sp" 
    android:textStyle="bold"/> 

<TextView 
    android:text="Concern" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView3" 
    android:layout_marginStart="16dp" 
    app:layout_constraintLeft_toLeftOf="parent" 
    android:layout_marginLeft="16dp" 
    tools:text="Concern" 
    app:layout_constraintTop_toTopOf="@+id/editText" /> 

<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="textPersonName" 
    android:ems="10" 
    android:id="@+id/editText" 
    android:layout_marginStart="120dp" 
    app:layout_constraintLeft_toLeftOf="parent" 
    android:layout_marginLeft="120dp" 
    android:layout_marginTop="64dp" 
    app:layout_constraintTop_toBottomOf="@+id/textView2" /> 

<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="textPersonName" 
    android:ems="10" 
    android:id="@+id/editText2" 
    app:layout_constraintLeft_toLeftOf="@+id/editText" 
    android:layout_marginTop="8dp" 
    app:layout_constraintTop_toBottomOf="@+id/editText" /> 

<TextView 
    android:text="Where" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView5" 
    tools:text="Where" 
    app:layout_constraintTop_toTopOf="@+id/editText2" 
    app:layout_constraintLeft_toLeftOf="@+id/textView3" /> 

<TextView 
    android:text="Description" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView6" 
    tools:text="Description" 
    app:layout_constraintLeft_toLeftOf="@+id/textView5" 
    app:layout_constraintTop_toTopOf="@+id/editText4" 
    android:minLines="3" 
    android:maxLines="5"/> 

<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="textMultiLine" 
    android:ems="10" 
    android:id="@+id/editText4" 
    android:layout_marginTop="8dp" 
    app:layout_constraintTop_toBottomOf="@+id/editText2" 
    app:layout_constraintLeft_toLeftOf="@+id/editText2" 
    android:maxLines="5" 
    android:minLines="3" /> 

<Button 
    android:text="Send S.O.S." 
    android:layout_width="0dp" 
    android:layout_height="wrap_content" 
    android:id="@+id/button" 
    app:layout_constraintLeft_toLeftOf="parent" 
    app:layout_constraintRight_toRightOf="parent" 
    app:layout_constraintHorizontal_bias="1.0" 
    app:layout_constraintBottom_toBottomOf="parent" /> 

<TextView 
    android:text="Phone" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView21" 
    app:layout_constraintLeft_toLeftOf="@+id/textView6" 
    app:layout_constraintTop_toTopOf="@+id/editText3" /> 

<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="phone" 
    android:ems="10" 
    android:id="@+id/editText3" 
    android:layout_marginTop="8dp" 
    app:layout_constraintTop_toBottomOf="@+id/editText4" 
    app:layout_constraintLeft_toLeftOf="@+id/editText4" /> 

    </ScrollView> 

如果它说ScrollView只能有一个孩子。 把儿童放在一个布局中,如LinearLayout