2017-03-07 79 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