2017-08-02 8 views
0

Ich möchte scrollbares Layout machen, weil mein TextView langen Text hat. Ich suchte und fand eine Lösung, wie zum Beispiel eine ScrollView in meinem RelativeLayout zu erstellen und dort ein anderes RelativeLayout zu erstellen. und änderte meinen XML-Code so. aber nichts ist passiert.Kann mein Layout nicht scrollbar machen

das ist mein xml-Code:

<RelativeLayout 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.example.arsh.fina.IntroActivity"> 

<include layout="@layout/content"/> 

<ScrollView 
    android:layout_marginTop="55dp" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_parent" 
    android:layout_marginTop="55dp"> 

    <ImageView 
     android:id="@+id/imageView3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="13dp" 
     android:adjustViewBounds="true" 
     app:srcCompat="@drawable/surv1" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentStart="true" /> 


    <TextView 
     android:layout_below="@+id/imageView3" 
     android:layout_marginTop="20dp" 
     android:textColor="#FFFFFF" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="A VERY 
     VERY 
     VERy 
     VERY TEXT"/> 


    </RelativeLayout> 

</ScrollView> 

<android.support.v4.widget.DrawerLayout 
    android:id="@+id/a1" 
    android:layout_height="match_parent" 
    android:layout_width="match_parent" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentStart="true" 
    android:layout_marginTop="55dp"> 


<android.support.design.widget.NavigationView 
    android:id="@+id/a2" 
    android:layout_gravity="right" 
    android:layout_height="match_parent" 
    android:layout_width="180dp" 
    app:headerLayout="@layout/header" 
    app:menu="@menu/drawer"/> 
</android.support.v4.widget.DrawerLayout> 

</RelativeLayout> 

wo ich schief gehen?

+0

was passiert eigentlich, wenn dies auf dem Gerät ist? – DroiDev

+0

@DroiDev nichts passiert ist. Emulator zeigt mir diese Aktivität. Ich glaube, ich sah die Bildlaufleiste, wenn die Aktivität für 1 oder 2 Sekunden startet, aber ich kann nicht scrollen. Was kann ich tun? – Arshiiia13

Antwort

0

Dies funktioniert auf dem Gerät. Der Grund, warum es wahrscheinlich nicht an Ihrem Ende scrollt, liegt darin, dass Sie mit dem von Ihnen bereitgestellten Code nichts scrollen können. das heißt du textivew ist nicht lang genug

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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.vzw.www.deviceid.MainActivity"> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     tools:layout_editor_absoluteY="8dp" 
     tools:layout_editor_absoluteX="0dp"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="55dp"> 

      <ImageView 
       android:id="@+id/imageView3" 
       android:layout_width="match_parent" 
       android:layout_height="30dp" 
       android:background="#cdcdcd" 
       android:layout_marginTop="13dp" 
       android:adjustViewBounds="true" 
       android:layout_alignParentTop="true" /> 


      <TextView 
       android:layout_below="@+id/imageView3" 
       android:layout_marginTop="20dp" 
       android:textColor="#000000" 
       android:textSize="50sp" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:text="A VERY 
     VERY 
     dfsdfdsf 
     sdf 
     dsfsdfsd 
     fds 
     fsdfsdf 
     sdf 
     sdf 
     sd 
     fsd 
     f 
     sdf 
     sdf 
     sdf 
     sdf 
     sd 
     fsd 
     f 
     sd 
     fsd 
     fds 
     fs 
     df 
     sd 
     fsd 
     fsd 
     f 
     sd 
     fsd 
     f 
     sdf 
     sd 
     f 
     VERy 
     VERY TEXT"/> 


     </RelativeLayout> 

    </ScrollView> 

</RelativeLayout> 
+0

wirklich wirklich danke für Ihre Zeit. meine Textansicht hat lange genug und ich tippe "sehr, sehr, sehr TEXT", um es zusammenzufassen. Ich habe eine Idee aus Ihrer Antwort, ich ändere den Standort meiner Scrollview und meine Schublade Navigation, und es funktioniert richtig !!!! : | danke für deine Zeit nochmal – Arshiiia13

+0

toll. Ich bin froh, dass meine Antwort geholfen hat. – DroiDev

Verwandte Themen