Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View entire content of ScrollView in Eclipse's graphical layout

Tags:

android

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

like image 966
user590849 Avatar asked Feb 28 '11 06:02

user590849


3 Answers

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.

like image 51
leocadiotine Avatar answered Nov 17 '22 16:11

leocadiotine


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" />
like image 10
Marco Gasparetto Avatar answered Nov 17 '22 15:11

Marco Gasparetto


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.

like image 3
Jokin Avatar answered Nov 17 '22 16:11

Jokin