Android 为什么我的列表视图的背景被暴露?
某些主要内容和所有节标题不填充其列表视图行。有什么问题吗Android 为什么我的列表视图的背景被暴露?,android,listview,background,Android,Listview,Background,某些主要内容和所有节标题不填充其列表视图行。有什么问题吗 date_section layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" andr
date_section layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#A1A1A1"
>
<TextView android:layout_width="fill_parent"
android:id="@+id/post_date"
android:layout_height="wrap_content"
android:textStyle = "normal"
android:textColor="#ffffff"
android:background="#A1A1A1"
android:textSize="15dp"
android:minHeight="0dp"
/>
</LinearLayout>
date\u区段布局:
单元布局:
<?xml version="1.0" encoding="utf-8"?>
<!-- hi new changes -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/list_background"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="80dp"
android:layout_weight="0.8">
<TextView android:layout_width="fill_parent"
android:id="@+id/post_title"
android:layout_height="wrap_content"
android:textStyle = "normal"
android:textColor="#202020"
android:textSize="15dp"
android:paddingTop="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="test"
/>
<TextView android:layout_width="fill_parent"
android:id="@+id/post_execerpt"
android:textColor="#888888"
android:textStyle = "italic"
android:textSize="14dp"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:lines="2"
android:text="test"
/>
</LinearLayout>
</LinearLayout>
在
date\u节.xml
文件中,将此行添加到TextView
android:layout_width="fill_parent"
祝你好运试着像hsnepen提到的那样,将文本视图宽度设置为“填充父对象”,确保列表项的“宽度填充父项”。@hsn已将其设置为“填充父项”。我正在编辑问题并添加布局代码。除了设置文本之外,是否在代码中更改任何
TextView
s的参数?是否可以尝试删除android:textStyle=“normal”
行?这只是猜测!