滚动型不工作 - 相对布局 [英] ScrollView not Working - Relative Layout
本文介绍了滚动型不工作 - 相对布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在滚动视图来包装一个realtive视图按照下面的code。然而,问题是,鉴于不滚动,即使视图的一部分是在屏幕上。我在模拟器上测试这个。
I am trying to wrap a realtive view in a scrollview as per the code below. However the problem is that the view doesn't scroll, even though part of the view is off the screen. I am testing this on the emulator.
<?xml version="1.0" encoding="UTF-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical"
>
<TextView
android:id="@+id/namedetail"
android:background="@drawable/backgroundstate"
android:layout_width="fill_parent"
android:gravity="center_vertical|center_horizontal"
android:layout_height="50dip"
android:textColor="#FF000000"
android:textStyle="bold"
android:textSize="15sp"
android:typeface="sans"
/>
<ImageView android:id="@+id/picturedetail"
android:layout_width="175dip"
android:layout_height="175dip"
android:layout_below="@id/namedetail"
android:layout_marginLeft="75dip"
android:layout_marginTop="10dip"
/>
<ImageView android:id="@+id/infoboxdetail"
android:layout_width="225dip"
android:layout_height="100dip"
android:layout_marginLeft="50dip"
android:layout_marginTop="10dip"
android:layout_below="@id/picturedetail"
android:background="@drawable/backgroundstate"
/>
<TextView
android:id="@+id/descriptiondetail"
android:background="@drawable/backgroundstate"
android:layout_width="fill_parent"
android:gravity="center_vertical|center_horizontal"
android:layout_height="50dip"
android:textColor="#FF000000"
android:textStyle="bold"
android:textSize="15sp"
android:typeface="sans"
android:layout_below="@id/infoboxdetail"
android:layout_marginTop ="10dip"
/>
</RelativeLayout>
</ScrollView>
修改
确定解决 - 用户的愚蠢 - 底部的文本框被关我的显示器屏幕,但不是在模拟器。使其不再生产,现在滚动。
OK solved - user stupidity - the bottom text box was off the screen on my monitor but not in the emulator. Making it longer makes it now scroll.
推荐答案
您 RelativeLayout的
是横向
并使用一个滚动型
,试试 HorizontalScrollView
代替。
Your RelativeLayout
is horizontal
and you use a ScrollView
, try a HorizontalScrollView
instead.
这篇关于滚动型不工作 - 相对布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文