Android微调器箭头始终位于其他视图上方

Android微调器箭头始终位于其他视图上方,android,android-spinner,Android,Android Spinner,在我的应用程序中,我在scrollView中有一些微调器(每个微调器都是片段的一部分)。此滚动视图位于文本视图的下方 问题是,当我在测试设备(三星Galaxy S6 Edge[G925F],API 23)上运行应用程序时,微调器的小箭头在textView上方保持可见,即使微调器的其余部分已经看不见了 我做了很多研究,但找不到任何解决方案,所以我在这里问: 我需要做什么才能使箭头像旋转器的其余部分一样消失 以下是一些图片: 在这张图片中,在我向下滚动之前,您可以在活动顶部和微调器下方看到textV

在我的应用程序中,我在scrollView中有一些微调器(每个微调器都是片段的一部分)。此滚动视图位于文本视图的下方

问题是,当我在测试设备(三星Galaxy S6 Edge[G925F],API 23)上运行应用程序时,微调器的小箭头在textView上方保持可见,即使微调器的其余部分已经看不见了

我做了很多研究,但找不到任何解决方案,所以我在这里问: 我需要做什么才能使箭头像旋转器的其余部分一样消失

以下是一些图片:

在这张图片中,在我向下滚动之前,您可以在活动顶部和微调器下方看到textView

在这个屏幕截图中,您可以看到问题所在。微调器的小三角形仍然可见,但微调器本身已从视图中滚动出去。

以下是包含微调器的片段的XML代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout
    android:id="@+id/fragLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <TextView
        android:id="@+id/gradeDisplay"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="15dp"
        android:layout_marginLeft="15dp"
        android:text="1"
        android:textSize="30dp"/>
    <Spinner
        android:id="@+id/spinner"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="30dp"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="15dp"
        android:entries="@array/grades"/>
    <ImageButton
        android:id="@+id/imageButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="15dp"
        android:layout_marginEnd="15dp"
        android:layout_marginRight="15dp"
        android:src="@drawable/ic_remove_black_24dp"
        android:background="@null"/>
</LinearLayout>
<Space
    android:layout_width="0dp"
    android:layout_height="5dp"
    android:layout_below="@id/fragLayout"/>
</RelativeLayout>

以下是主要活动内容的代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="de.jeanma.android.avo.MainActivity"
tools:showIn="@layout/activity_main">
    <Space
        android:id="@+id/mainContentSpace"
        android:layout_width="match_parent"
        android:layout_height="16dp" />
    <TextView
        android:id="@+id/textView"
        android:layout_below="@id/mainContentSpace"
        android:layout_width="match_parent"
        android:text="Standard text"
        android:layout_height="wrap_content"
        android:textSize="40dp"
        android:gravity="end"/>
    <ScrollView
        android:id="@+id/scrollView"
        android:layout_below="@id/textView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout
            android:id="@+id/layout"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:divider="@drawable/divider"
            android:showDividers="middle">
        </LinearLayout>
    </ScrollView>
</RelativeLayout>

片段通过Java方法添加到LinearLayout(@id/layout)。如果需要,我也会在这里发布

我使用的是Java1.8.05,目标SDK是23,最小是14。代码是在Android Studio中编写的


出现问题的文本视图是
@id/textView
,它在顶部显示了一个大数字。

我现在有了一个解决方法。正如我建议的那样,当我将textView的背景色设置为与我的活动相同时,arrrows将不再显示。但空间确实表现得很不稳定。在这里我改变了背景颜色。所以我就把它拿走了。(看起来还不错)

可在此处查看MainActivity'a内容的更新XML文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="de.jeanma.android.avo.MainActivity"
tools:showIn="@layout/activity_main">
    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:text="Standard text"
        android:layout_height="wrap_content"
        android:textSize="40dp"
        android:gravity="end"
        android:background="#FAFAFA"/>
    <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textView">
        <LinearLayout
            android:id="@+id/layout"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:divider="@drawable/divider"
            android:showDividers="middle">
        </LinearLayout>
    </ScrollView>
</RelativeLayout>

感谢@ScriptKity@Wukash@Bryan的支持

@jeanma您只需设置

android:background="#00FFFFFF"

对于ScrollView或根线布局,在ScrollView中设置父布局的背景色

    android:background="@color/white"

真奇怪。0,0是文本视图吗?它是什么id以及它在哪个布局中?这不是答案,但是:您是否为该scrollview中的每个微调器添加了一个片段?这不是有点过分了吗?最好使用简单的ListView或RecyclerView,除非你真的需要这么多的片段。它的id是
@id/textView
@ScriptKittyYes,但该片段还包含一个按钮和一个TextView。我需要不同数量的。晶圆厂正在添加它们@Wukash@JeanmaWukash的建议仍然有效。listview可以采用自定义布局。至于你的问题,idk如果可以的话,我必须先把它放在我的电脑上,但是因为它是线性布局,你能降低滚动视图的高度吗?你能看看这个吗?我在使用包含微调器的项时遇到了几乎相同的问题。非常感谢。
    android:background="@color/white"