简体   繁体   English

滚动视图无响应

[英]Scroll view does not respond

Works great for portrait mode. 非常适合纵向模式。 If I go on landscape mode I have my activity drawn in the center of screen which leaves blank screen on both left and right side. 如果我使用横向模式,则我的活动会绘制在屏幕中央,左侧和右侧都会显示空白屏幕。 If I drag by keeping mouse on views (ie center)the scroll takes effect. 如果我通过将鼠标保持在视图(即中心)上来拖动,则滚动会生效。 If I drag on empty right side no scrolling ? 如果我在空的右侧拖动,没有滚动? why ? 为什么呢?

附加 the image 图片

posting my layout xml 发布我的布局xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <ScrollView
        android:id="@+id/enter_pin_scroll"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scrollbarStyle="outsideOverlay" >

        <RelativeLayout
            android:id="@+id/enter_pin_header_layout"
            android:layout_width="@dimen/pin_inset_region_width"
            android:layout_height="@dimen/pin_inset_region_height"
            android:layout_centerHorizontal="true"
            android:layout_gravity="center_horizontal" >

            <LinearLayout

将滚动视图的宽度设置为fillparent换行

android:layout_width="fill_parent"

Presumably, your ScrollView's width is set to wrap_content and thus, touch events outside of the dial pad are not taking any effect. 据推测,您的ScrollView的宽度设置为wrap_content ,因此,拨号盘外部的触摸事件不会起作用。

You can fix this by changing, 您可以通过更改来解决此问题,

<ScrollView 
    android:layout_width="wrap_content" 
    ... />

to, 至,

<ScrollView 
    android:layout_width="match_parent" 
    ... /> 

If every view is stored in the ScrollView, why not remove the RelativeLayout ? 如果每个视图都存储在ScrollView中,为什么不删除RelativeLayout? Have directly : 直接拥有:

<ScrollView
    android:id="@+id/enter_pin_scroll"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:scrollbarStyle="outsideOverlay" >

    <RelativeLayout
        android:id="@+id/enter_pin_header_layout"
        android:layout_width="@dimen/pin_inset_region_width"
        android:layout_height="@dimen/pin_inset_region_height"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center_horizontal" >

If you want to keep it : 如果您想保留它:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

Set the layout_height to fill_parent. 将layout_height设置为fill_parent。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM