View entire content of ScrollView in Eclipse's

2020-03-01 06:55发布

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

标签: android
8条回答
够拽才男人
2楼-- · 2020-03-01 07:04

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" />
查看更多
等我变得足够好
3楼-- · 2020-03-01 07:07

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.

查看更多
冷血范
4楼-- · 2020-03-01 07:15

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

查看更多
beautiful°
5楼-- · 2020-03-01 07:18

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

<ScrollView ... >
    <LinearLayout ...
        scrollY="300dp">
    </LinearLayout>
</ScrollView>
查看更多
戒情不戒烟
6楼-- · 2020-03-01 07:21

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.

查看更多
老娘就宠你
7楼-- · 2020-03-01 07:21

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.

查看更多
登录 后发表回答