2014-02-19 38 views
2

在我的图形布局中,即使设置了滚动视图,它也会在屏幕末尾切断。有没有办法扩展图形布局,以便我可以看到整个滚动视图,而不仅限于屏幕大小?如何扩展android图形布局屏幕大小?

XML代码:

<?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" > 
+0

检查是否在某处添加了边距/填充。如果你可以附加屏幕截图,那将会很好。 – Sharj

+0

刚刚添加的代码 – Piofmc

回答

3

您的ScrollViewRelativeLayout的高度裁剪,尽管它设置为wrap_layout。取决于布局要求,您可能不需要容器ScrollView。如果是这种情况,请删除layoutChampions并将ScrollView设置为根。这将使预览屏幕忽略高度限制,并让您看到完整的布局。

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

如果您需要为您的ScrollView和其他一些View个容器,你可能希望有更大的(更高)的预览画面。您可以创建自定义设备作为解决方法。

  • 打开“Android虚拟设备管理器”(在Eclipse中,从“窗口”菜单访问)
  • 进入“设备定义”选项卡
  • 选择任何你想要的设备,然后按“克隆... “(您也可以从头开始创建)
  • 将高度分辨率更改为某个较大的值(例如4096px)。您还可以将名称更改为防止混淆,今后
  • 按“克隆设备”

由于定制设备已经建立,现在你可以选择它的预览画面上。 (如果没有出现,重新启动Eclipse)。

+0

解决了它,非常感谢! – Piofmc

1

更新时间:

有没有办法来滚动滚动型在Eclipse图形布局。但是,您可以执行以下其中一项操作。

使用大屏幕创建预览器并查看您的全部内容。

+0

似乎并不可悲 – Piofmc

+0

代码中还可能有其他内容。但是,如果您的根布局只有宽度和高度match_parent,那么它将占用整个屏幕大小。 – Sharj

+0

不知道我是否沟通不畅,但我想要做的是:http://examples.javacodegeeks.com/wp-content/uploads/2013/05/graphics-layout.jpg – Piofmc

相关问题