简体   繁体   中英

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" >

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 View s, 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 (eg 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).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM