Tano February 2016

Android ScrollView Icons

I am developing an app using the scroll view but I have problem. The first button is not visible entirely when I scroll to the top here is my xml and image from the app.I have tried different different ways to fix it but was not possible ://(in the image you can see that the first button is not visible only some part of is visible)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@mipmap/background">

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="100dp"
        android:layout_height="280dp"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true">

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:orientation="vertical">

            <Button
                android:id="@+id/button1"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:background="@mipmap/angle" />
            <Button
                android:id="@+id/button2"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:background="@mipmap/currency" />
            <Button
                android:id="@+id/button3"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:layout_centerInParent="true"
                android:background="@mipmap/area" />
            <Button
                android:id="@+id/datasize"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:background="@mipmap/datasize" /&g        

Answers


Hamidreza Samadi February 2016

this code works for me: removing android:layout_gravity="center" from LinearLayout

    <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@mipmap/background">

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="100dp"
        android:layout_height="280dp"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true">

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <Button
                android:id="@+id/button1"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:background="@mipmap/angle" />
            <Button
                android:id="@+id/button2"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:background="@mipmap/currency" />
            <Button
                android:id="@+id/button3"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:layout_centerInParent="true"
                android:background="@mipmap/area" />
            <Button
                android:id="@+id/datasize"
                android:layout_width="100dp"
                android:layout_height="100dp"
                android:background="@mipmap/datasize" />
        </LinearLayout>

    </ScrollView>

</RelativeLayout>

Post Status

Asked in February 2016
Viewed 3,093 times
Voted 9
Answered 1 times

Search




Leave an answer