Dapina
Dapina

Reputation: 47

How to scroll the screen (how to move screen)

I want to scroll main.xml screen. As I know, ScrollView is suitable for this but I used AbsoluteLayout. so it didn't work.

is there any way to do this. here is the xml codes:

    <AbsoluteLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">


    <TextView
    android:id="@+id/txtad"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Ad"
    android:layout_x="0dip"
    android:layout_y="20dip"
    android:textSize="20sp"
    android:textStyle="bold"
    android:textColor="#ffffff"
    >
    </TextView>
    <EditText
    android:id="@+id/editad"
    android:layout_width="200px"
    android:layout_height="45px"
    android:textSize="12sp"
    android:layout_x="80dip"
    android:layout_y="5dip"
    >
    </EditText>

    <TextView
    android:id="@+id/txtsoyad"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Soyad"
    android:layout_x="0dip"
    android:layout_y="75dip"
    android:textSize="20sp"
    android:textStyle="bold"
    android:textColor="#ffffff"
    >
    </TextView>
    </AbsoluteLayout>

Upvotes: 0

Views: 3804

Answers (1)

TofferJ
TofferJ

Reputation: 4784

Put a ScrollView outside of your layout like this:

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <!-- Your AbsoluteLayout goes here -->

</ScrollView>

Please note that the AbsoluteLayout class is deprecated. You should probably use e.g. a FrameLayout instead.

BR, Christoffer

Upvotes: 2

Related Questions