簡體   English   中英

上下滾動ListView會丟失列表中的頂部和底部項目-附加的屏幕截圖

[英]Scrolling up and down the ListView loses the top and bottom items in the list - Screenshot attached

我有一個活動,其中包含以下各項:在活動頂部顯示操作欄(一個imageview,一個視圖和兩個imagebutton),對於屏幕的其余部分,我有一個ListView。 這些全部放置在main.xml布局中。 列表將永遠不再有6行,並且該活動上的操作欄不可見。

上下滾動時,列表視圖會丟失某些行中的文本/圖像。

滾動之前(抱歉,我不得不隱藏徽標)

滾動之前http://img706.imageshack.us/img706/37/32572081.png

上下滾動后(注意DGL查找文本消失)

第一次滾動后http://img638.imageshack.us/img638/7334/4scrollup.png

上下滾動后(請注意,“ DGL查找”仍然不存在,並且危險類別的圖形和文本也消失了)

一次又一次滾動http://img839.imageshack.us/img839/4970/5scrolldownagain.png

如果我繼續上下滾動,行可能會再次出現並且可能會消失。

這是我的main.xml

<?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="fill_parent"
    android:background="#FFF"
    android:orientation="vertical" >

    <include layout="@layout/action_bar" />

    <ImageView
        android:id="@+id/splashscreen"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center" >
    </ImageView>

    <ListView
        android:id="@android:id/list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:cacheColorHint="#00000000"
        android:textColor="#000" >
    </ListView>
</LinearLayout>

任何快速幫助! 我是Android的新手

@弗蘭肯斯坦:謝謝您的幫助,您給了我螺紋頭,我一直遵循它直到找到解決方案。

問題是列表視圖在屏幕上顯示一定數量的行,並在使用getView方法上下滾動時顯示更多行。 顯示的新行通常將采用它們要替換的行的樣式。

因此,如果row1的字體樣式與其他字體不同,那么將取代它的行將繼承相同的字體樣式。 您可能會執行的操作,檢查這是否是不應該繼承樣式的其他行,然后將樣式更改為您喜歡的樣式。

查看本文http://android.amberfog.com/?p=296 ,它將以技術方式解釋我剛才所說的內容

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM