简体   繁体   English

Android - 滚动视图不起作用

[英]Android - ScrollView doesn't work

I have this Layout created.我创建了这个布局。 Inside the LinearLayout there are some TextViews.在 LinearLayout 中有一些 TextViews。 If i run this on an emulator, I am able to scroll for some seconds after that the activity freezes.(scrolling in listviews works fine!).如果我在模拟器上运行它,我可以在活动冻结后滚动几秒钟。(在列表视图中滚动工作正常!)。 Going back in my app to the MainActivity works.在我的应用程序中返回 MainActivity 工作。

The corresponding java file to this activity, is the default file you will get if you create a new activity in eclipse.此活动对应的 java 文件是在 eclipse 中创建新活动时将获得的默认文件。

Did I made something wrong?我做错了什么吗?

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="vertical">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin" >

 <!-- stuff -->



</LinearLayout>

</ScrollView>

将 android:layout_height="match_parent" 更改为 android:layout_height="wrap_content"

将 themes.xml 或 styles.xml 中的 parent 属性更改为:

<style name="dont  touch this" parent="Theme.AppCompat.DayNight.NoActionBar">

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

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