Piofmc
Piofmc

Reputation: 365

How to expand the android graphical layout screen size?

In my graphical layout, it cuts off at the end of the screen, even if I have a scrollview set up. Is there a way to expand the graphical layout so that I can see the entire scrollview and not just limited to the screen size?

xml Code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layoutChampions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

Upvotes: 2

Views: 1445

Answers (2)

Andrew T.
Andrew T.

Reputation: 4707

Your ScrollView is cropped by RelativeLayout's height, even though it's set to wrap_layout. Depends on the layout requirement, you probably don't need a container for ScrollView. If that's the case, remove layoutChampions and set ScrollView as the root. This will make the preview screen ignore the height limit, and let you see the full layout.

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        ...

    </LinearLayout>
</ScrollView>

If you need a container for your ScrollView and some other Views, you probably want to have larger (higher) preview screen. You can create custom device as the workaround.

  • Open "Android Virtual Device Manager" (In Eclipse, accessible from "Window" menu)
  • Go to "Device Definitions" tab
  • Select any device you want, and press "Clone..." (You can create from scratch, too)
  • Change the height resolution to some large value (e.g. 4096px). You may also change the name to prevent confusion in the future
  • Press "Clone Device"

As the custom device has been created, you can now select it on the preview screen. (Restart Eclipse if it doesn't appear).

Upvotes: 3

Sharjeel
Sharjeel

Reputation: 15798

Updated:

There's no way to Scroll ScrollView in Eclipse Graphical Layout. However you can do one of following things.

Create a Previewer with Large Screen and see your whole content.

Upvotes: 1

Related Questions