第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

滾動(dòng)時(shí)背景ListView變?yōu)楹谏?/h1>

我創(chuàng)建了一個(gè)特定的列表,該列表存在于以下元素之外,以創(chuàng)建一個(gè)可滾動(dòng)的列表,每行的左側(cè)包含一個(gè)圖像,右側(cè)包含一些文本:首先使用“根”布局:<LinearLayout    xmlns:android="http://schemas.android.com/apk/res/android"    android:orientation="vertical"    android:layout_width="fill_parent"     android:layout_height="fill_parent"    android:background="#C8C8C8"    >    <TextView        android:layout_width="fill_parent"        android:layout_height="wrap_content"/>    <ListView        android:id="@android:id/list"        android:layout_width="fill_parent"         android:layout_height="fill_parent"        android:drawSelectorOnTop="false"        android:divider="#C8C8C8"        android:background="#C8C8C8"/></LinearLayout>然后在ListView中放置以下“行”項(xiàng):<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:orientation="horizontal"    android:background="@drawable/bg_row">    <ImageView        android:layout_width="wrap_content"        android:paddingLeft="10px"        android:paddingRight="15px"        android:paddingTop="5px"        android:paddingBottom="5px"        android:layout_height="wrap_content"        android:src="@drawable/bg_image"    />    <TextView        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:paddingTop="5px"        android:paddingBottom="5px"        android:textSize="16sp"        android:textColor="#000000"        android:layout_gravity="center"        android:maxHeight="50px"/></LinearLayout>只要屏幕是靜態(tài)顯示的(靜止不動(dòng)),它將正確顯示,但是當(dāng)我開始滾動(dòng)列表時(shí),將顯示行項(xiàng)目的背景(代碼中可以顯示“圖標(biāo)”)可以正確顯示,但“根”布局的背景將變?yōu)橥耆谏?..當(dāng)滾動(dòng)停止時(shí),背景通常會(huì)恢復(fù)其顏色...當(dāng)我測試時(shí),我還在TextView該根元素中添加了一個(gè)在相同的背景下,滾動(dòng)列表時(shí),該顏色將保留其顏色...知道為什么會(huì)發(fā)生這種情況以及如何解決此問題嗎?
查看完整描述

4 回答

?
慕后森

TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超5個(gè)贊

android:id="@android:id/list"

android:layout_width="fill_parent" 

android:layout_height="fill_parent"

android:drawSelectorOnTop="false"

android:divider="#C8C8C8"

android:background="#C8C8C8"

android:cacheColorHint="#00000000"/>


查看完整回答
反對 回復(fù) 2019-11-05
?
一只斗牛犬

TA貢獻(xiàn)1784條經(jīng)驗(yàn) 獲得超2個(gè)贊

在ListView標(biāo)簽上添加屬性


android:cacheColorHint="#00000000" // setting transparent color


查看完整回答
反對 回復(fù) 2019-11-05
?
神不在的星期二

TA貢獻(xiàn)1963條經(jīng)驗(yàn) 獲得超6個(gè)贊

非常簡單,只需在布局文件中使用以下行:


android:scrollingCache="false"

像這樣:


<ListView 

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:scrollingCache="false"

/>


查看完整回答
反對 回復(fù) 2019-11-05
?
喵喔喔

TA貢獻(xiàn)1735條經(jīng)驗(yàn) 獲得超5個(gè)贊

您可以這樣使用:


list.setCacheColorHint(Color.TRANSPARENT);

list.requestFocus(0);


查看完整回答
反對 回復(fù) 2019-11-05
  • 4 回答
  • 0 關(guān)注
  • 482 瀏覽

添加回答

了解更多

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)