【发布时间】:2015-01-30 10:48:55
【问题描述】:
我有一个问题。我创建了列表视图,它将成为 navigationDrawer 中的幻灯片。我可以在 Android 2.X 和 5.X 中看到很好的文本,但在 4.2.2 中文本是不可见的。 这是代码:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Listview to display slider menu -->
<ListView
android:id="@+id/listDrawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:cacheColorHint="@color/nliveo_white"
android:choiceMode="singleChoice"
android:divider="@color/nliveo_transparent"
android:background="@color/nliveo_white"
android:dividerHeight="0dp"/>
</android.support.v4.widget.DrawerLayout>
以及商品代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
tools:ignore="MissingPrefix">
<RelativeLayout
android:id="@+id/layoutDados"
android:layout_width="match_parent"
android:layout_height="48dp">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:id="@+id/rowIcon"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_centerVertical="true"
android:contentDescription="descc" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/rowTitle"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_toRightOf="@+id/rowIcon"
android:layout_toEndOf="@+id/rowIcon"
android:textSize="14sp"
android:textDirection="anyRtl"
android:textColor="#000"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"/>
</RelativeLayout>
</LinearLayout>
我做错了什么?
【问题讨论】:
-
尝试从您的 ListView 布局中删除这一行 android:cacheColorHint="@color/nliveo_white"
-
@Govtart 还是不行
-
尝试 #ff000000 而不是 #000
-
不工作,我不知道这是在做什么
标签: java android android-listview navigation-drawer