【问题标题】:TextView not visible within scrollViewTextView 在 scrollView 中不可见
【发布时间】:2016-05-26 23:35:16
【问题描述】:

scrollView 中的TextView 不可见,即使在组件树中也是如此。

当我将鼠标悬停在 scrollView 或 TextView 上时,它会显示:此检查会突出显示 Android 资源文件和 AndroidManifest.xml 中不允许的 XML 标记。

我在RelativeLayout 中添加了tools:ignore="contentDescription",当我将鼠标悬停在第一个ImageView 上时,这解决了[Accessibility] Missing contentDescription attribute on image 问题。但是没有解决我的TextViewscrollView中可见的问题

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:paddingStart="12dp"
    android:paddingEnd="10dp"
    android:paddingTop="10dp"
    android:paddingBottom="10dp"
    android:background="#f9f9f9"
    tools:ignore="contentDescription"
    tools:context="com.example.william.notebook.NoteViewFragment">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/viewNoteIcon"
        android:src="@drawable/p"
        android:layout_alignParentTop="true"
        android:layout_alignParentStart="true"
        android:layout_marginEnd="15dp"/>

    <scrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/noteScrollView"
        android:layout_alignParentTop="true"
        android:layout_alignParentEnd="true"
        android:layout_toEndOf="@+id/viewNoteIcon"
        android:layout_alignBottom="@+id/viewNoteIcon">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="Note Title"
            android:id="@+id/viewNoteTitle" />
    </scrollView>

</RelativeLayout>

【问题讨论】:

    标签: android xml android-layout


    【解决方案1】:

    你写了&lt;scrollView&gt;..&lt;/scrollView&gt;,而正确标签是&lt;ScrollView&gt;...&lt;/ScrollView&gt;

    【讨论】:

    • 还要确保您的文本颜色与背景颜色形成良好的对比:)
    猜你喜欢
    • 2013-07-06
    • 2016-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多