user590849
user590849

Reputation: 11785

View entire content of ScrollView in Eclipse's graphical layout

I'm using Eclipse Helios 3.6.2 for Android development and whenever I design a layout in the graphical layout mode (not the XML layout), I can't see the entire content of a ScrollView in the graphical layout.

Specifically, when I'm using a ScrollView and the height of the ScrollView exceeds the height of the content view area (i.e., the phone screen visible in the graphical layout mode), I am not able to see the items that I have at the bottom of the screen.

In Eclipse Helios 3.6.1 there was an option called "expand to fit"; whenever I used to click on it, the phone screen increased in size to encompass all the elements that I had added. How do i achieve the same thing in 3.6.2?

Graphical layout marking where I want to see the full view

Upvotes: 17

Views: 12722

Answers (8)

Italo Borssatto
Italo Borssatto

Reputation: 15699

Use the android:scrollY in the ScrollView child and remove it before publishing.

<ScrollView ... >
    <LinearLayout ...
        scrollY="300dp">
    </LinearLayout>
</ScrollView>

Upvotes: 0

P K
P K

Reputation: 1

Just click on the Config window of the Graphical Layout and click on the preview for all screen sizes and u will be able to see your scroll

Upvotes: 0

Weslei Prudencio
Weslei Prudencio

Reputation: 469

If use Relative layout, you can use layout_marginTop negative, like that:

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="-500px" 
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/linearLayout" >

Increase the layout_marginTop to move scrollview.

Upvotes: 1

Marco Gasparetto
Marco Gasparetto

Reputation: 453

Use an included layout for the scrollview.

Move the entire scrollview layout in a separated file (ie: my_scrollview.xml).

<?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" >
    ...
</ScrollView>

The layout editor will then display the entire scrollview.

In the main layout use in place of the scrollview something like:

<include layout="@layout/my_scrollview" />

Upvotes: 9

Jokin
Jokin

Reputation: 4218

There was a button that allow to remove the clipping generated in a scroll view and show all the views that you have inside it.

In later sdk versions the button is removed, and the view mode is triggered if the scroll view is the root element of the view, so my solution when this doesn't happen (because you have a relative layout with some buttons over the view for example) is extracting the scrollview to it's own view, and including it in the original layout with an include tag.

Upvotes: 3

Kevin M
Kevin M

Reputation: 347

My quick fix.

In the upper right corner of the graphic layout window you will see a drop down menu that shows what minimum version of android you are creating for. Make sure you have it set to at least android 2.1. I had an app at 1.6 and i had the same issue you have. swapped minimum build platform to 2.1 and it was magic.

Hope this helps.

Upvotes: 2

leocadiotine
leocadiotine

Reputation: 3314

There's no way to scroll the content inside the Android Layout Editor. What you can do, though, is create a new device simulation with a huge height, so you can see what is hidden in the ScrollView.

To do so, go to the dropdown menu below "Editing config" ang choose "Custom..." (top-left corner of the Android Layout Editor). Select one of your preferred resolutions (mine is 3.7in WVGA) and hit "Copy". The copied resolution will appear in the "Custom" group in the bottom of the list.

Choose your new configuration and hit "Edit...". In there, you can select the "Screen Dimension" property and change the value. I created a resolution 2000x480 (portrait). This way, I can see the whole content inside the ScrollView.

Hope it helps.

Upvotes: 16

Ted Hopp
Ted Hopp

Reputation: 234847

The drop-down on the left (under the text "Editing config: ...") allows you to change the simulated screen size in the graphical layout. Perhaps that is what you are looking for.

Upvotes: 0

Related Questions