0

Can anyone explain to me why I can't show the content of address using the following XML code. Thank you so much in advance. The content should be more than 3 lines, but only two lines of content are showed when I execute the program.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#e6e6e6"
android:orientation="vertical"
android:padding="1dp">

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



        <TextView

            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="#868585"
            android:padding="0dp"
            android:text="Basic Information"
            android:textColor="#ffffff" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="9"
                    app:srcCompat="@drawable/navigation" />

                <TextView
                    android:id="@+id/textView7"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Address" />
            </LinearLayout>


            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@android:color/darker_gray" />


        </LinearLayout>


    </LinearLayout>
</ScrollView>

Michael
  • 183
  • 2
  • 10
  • 2
    First Your scrollview should have only 1 child view. Secondly your Address text view has height of match_parent rather than wrap_content – Kapil G Jul 18 '17 at 09:17

3 Answers3

1

your all control not visible due scroll view because scroll view can haldle direct one child try to make your layout like this

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

 <LinearLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:orientation="vertical">   


    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="#868585"
        android:padding="0dp"
        android:text="Basic Information"
        android:textColor="#ffffff" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="9"
                app:srcCompat="@drawable/navigation" />

            <TextView
                android:id="@+id/textView7"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="Address" />
        </LinearLayout>


        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@android:color/darker_gray" />


    </LinearLayout>

</LinearLayout>

</ScrollView>
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
0

try this

 <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#e6e6e6"
        android:orientation="vertical"
        android:padding="1dp">

        <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:layout_width="match_parent"
                    android:layout_height="0dp"
                    android:layout_weight="1"
                    android:background="#868585"
                    android:padding="0dp"
                    android:text="Your text here"
                    android:textColor="#ffffff" />

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">
                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_weight="9"/>

                    <TextView
                        android:id="@+id/textView7"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_weight="1"
                        android:text="Address" />
                </LinearLayout>
                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:background="@android:color/darker_gray" />
            </LinearLayout>
        </ScrollView>
    </LinearLayout>
0

Try This. Scroll view only handle one direct class and then give imageview height matchparent

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#e6e6e6"
    android:orientation="vertical"
    android:padding="1dp">

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

<LinearLayout
    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <TextView

        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="#868585"
        android:padding="0dp"
        android:text="Basic Information"
        android:textColor="#ffffff" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="9"
                app:srcCompat="@mipmap/ic_launcher" />

            <TextView
                android:id="@+id/textView7"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:text="Addhhhhhhhhhhhhhhhhhhvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhress" />
        </LinearLayout>


        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@android:color/darker_gray" />


    </LinearLayout>
</LinearLayout>
</ScrollView>

</LinearLayout>
susaine
  • 141
  • 1
  • 9