简体   繁体   中英

Android - ScrollView doesn't work

I have this Layout created. Inside the LinearLayout there are some 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.

The corresponding java file to this activity, is the default file you will get if you create a new activity in 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">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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