全屏模式下 ScrollView 不起作用

3

在我的应用程序中,我正在使用主题

android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen"

在我的布局中使用了 android:fillViewport="true",但是滚动不起作用。当我移除全屏属性 android:theme="@android:style/Theme.Holo.NoActionBar" 后,它就可以工作了。有任何解决方法吗?
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:fillViewport="true" >
<LinearLayout
                android:id="@+id/nameFields"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <TextView

                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/versionNumber"
                    android:textAppearance="?android:attr/textAppearanceLarge"
                    android:textSize="15pt" />



                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="15dp"
                    android:text="@string/time_between_records"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="@string/base_directory"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="15dp"
                    android:text="@string/continuous_mode"
                    android:textAppearance="?android:attr/textAppearanceLarge" />



                <TextView
                    android:id="@+id/minIcpValue"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="@string/minIcpValue"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:id="@+id/maxIcpValue"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:text="@string/maxIcpValue"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:id="@+id/alarmsMode"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="15dp"
                    android:text="@string/alarmsMode"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:id="@+id/clinicalMode"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:text="@string/clinicMode"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:id="@+id/trialID"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="15dp"
                    android:text="@string/clinicId"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:id="@+id/snapShotMode"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="15dp"
                    android:text="@string/snapshot_mode"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:id="@+id/screenShotMode"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:text="@string/screenshot_mode"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:id="@+id/enableTrialMode"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="@string/enableClinicalTrialScreen"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="@string/monitorName"
                    android:textAppearance="?android:attr/textAppearanceLarge" />


            </LinearLayout>
</ScrollView>
1个回答

3

不要应用主题来移除操作栏。

您需要在设置内容视图之前以编程方式删除操作栏,如下所示。

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

将LinearLayout的高度更改为fill_parent。您从清单中删除了主题吗? - Pankaj Arora
相同的结果。是的,我已经删除了它。 - HK.avdalyan
我发现这是一个已知的问题。 {link}(https://dev59.com/XGs05IYBdhLWcg3wJurp) - HK.avdalyan

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接