Android的ListView的行为不同的同类型的设备(Android listview beha

2019-10-21 16:55发布

我与快要把我逼疯了问题战斗:我有一个非常简单的ListView它的设备上流畅滚动,另一设备几乎是100%相同的非常luggy。

在这里你可以找到luggy滚动的视频,并在这里你可以找到(几乎)平滑滚动的视频。

缓慢滚动发生与设备上这个规格时,平滑滚动发生与设备上这个规格

这里是我使用的(显然是在利用ViewHolder模式)的非常基本的代码,到底如何可以说,它是可能吗? 请有人帮助我!

public DealerAdapter(Context context, int skinLayoutResourceId, ArrayList<Dealer> items) {
        super(context, skinLayoutResourceId, items);
        _items = items;
        mContext = context;
        layout = skinLayoutResourceId;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        DealerViewHolder holder = null;
        // reuse views
        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(layout, null);
            // configure view holder
            holder = new DealerViewHolder();
            holder.lblName = (TextView) convertView.findViewById(R.skinDealer.lblNameSurname);
            holder.lblSapCode = (TextView) convertView.findViewById(R.skinDealer.lblSapCode);
            holder.lblAddress = (TextView) convertView.findViewById(R.skinDealer.lblAddress);
            convertView.setTag(holder);
        } else
            holder = (DealerViewHolder) convertView.getTag();
        try {
            holder.lblName.setText(_items.get(position).getName());
            holder.lblCode.setText(_items.get(position).getCode());
            holder.lblAddress.setText(_items.get(position).getAddress());
        } catch (Exception e) {
            // TODO: handle exception
        }
        return convertView;
    }

    static class DealerViewHolder {
        TextView lblName;
        TextView lblAddress;
        TextView lblCode;
    }

编辑:

我测试另一三星设备上的相同的代码,星系音符10.1,用相同的OS版本为具有平滑滚动所述一个和与功能更强大的硬件,其结果是surprending !! 这里是行为, 这里是设备的规格。

有些时候,Android是一个真正巨大的问号!!!!

编辑2:

下面是logcat的同时用机器人4.2.2设备上执行的滚动

01-27 10:34:59.994: V/AlarmManager(2371): waitForAlarm result :8
01-27 10:35:00.004: D/KeyguardClockWidgetService(4910): onReceive action=android.intent.action.TIME_TICK
01-27 10:35:00.004: V/AlarmManager(2371): ClockReceiver onReceive() ACTION_TIME_TICK
01-27 10:35:00.034: D/IconMerger(2561): overflowShown = false
01-27 10:35:00.034: D/IconMerger(2561): moreRequired = false
01-27 10:35:00.094: I/WAKELOCK_RELEASE(2371): TIMESTAMP=3927849415108, TAG=AlarmManager, TYPE=PARTIAL_WAKE_LOCK             , COUNT=0, PID=2371, UID=1000
01-27 10:35:00.474: I/InputReader(2371): Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.146 ] when=3598409874000
01-27 10:35:00.474: I/InputDispatcher(2371): Delivering touch to: action: 0x0
01-27 10:35:00.494: I/ThermalZone(2371): TEMP 41000 newMaxSensorState 0
01-27 10:35:00.504: I/CustomFrequencyManager(4461): newFrequencyRequest  - mFrequency = 800000, mTimeoutMs = -1, mPkgName = LIST_SCROLL_BOOSTER@3
01-27 10:35:00.504: I/CustomFrequencyManager(4461): Boost Request from package = LIST_SCROLL_BOOSTER@3 frequency : 800000type = 6
01-27 10:35:00.504: I/CustomFrequencyManager(4461): !! pkgName = LIST_SCROLL_BOOSTER@3
01-27 10:35:00.504: I/CustomFrequencyManager(4461): Request from package name pkgName = LIST_SCROLL_BOOSTER@3
01-27 10:35:00.504: I/CustomFrequencyManager(4461): mContext is Not Null  mContext.pkgName = com.reply.fasttrack
01-27 10:35:00.504: I/CustomFrequencyManager(4461): mToken is Null....Creating New Binder!
01-27 10:35:00.504: I/CustomFrequencyManager(4461): CPUDVFSControlRequest : doFrequencyRequest::  = 800000 Timeout : -1
01-27 10:35:00.504: I/power(2371): *** acquire_dvfs_lock : lockType : 1  freq : 800000 
01-27 10:35:00.504: D/CustomFrequencyManagerService(2371): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency : 800000  uid : 10169  pid : 4461  pkgName : LIST_SCROLL_BOOSTER@3
01-27 10:35:00.614: I/InputReader(2371): Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=3598555846000
01-27 10:35:00.614: I/InputDispatcher(2371): Delivering touch to: action: 0x1
01-27 10:35:01.984: I/Monitor(2371): SIOP:: Current AP = 365, CP = 0
01-27 10:35:03.354: D/BatteryService(2371): update start
01-27 10:35:03.354: D/BatteryService(2371): level:21, scale:100, status:3, health:2, present:true, voltage: 3614, temperature: 319, technology: Li-ion, AC powered:false, USB powered:true, Wireless powered:false, icon:17303346, invalid charger:0, online:4, charge type:1, current avg:-368
01-27 10:35:03.354: D/BatteryService(2371): Sending ACTION_BATTERY_CHANGED.
01-27 10:35:03.364: D/STATUSBAR-BatteryController(2561): onReceive() - ACTION_BATTERY_CHANGED
01-27 10:35:03.364: D/STATUSBAR-BatteryController(2561): onReceive() - BATTERY_STATUS_DISCHARGING: tw_stat_sys_battery_usb_not_charge
01-27 10:35:03.364: D/STATUSBAR-PhoneStatusBar(2561):  mBrightnessEnablebySettings = true mBrightnessEnablebyBattery = true mBrightnessEnablebyDisableFlag = true
01-27 10:35:03.514: I/power(2371): *** release_dvfs_lock : lockType : 1 
01-27 10:35:03.514: D/CustomFrequencyManagerService(2371): releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT  frequency : 800000  uid : 10169  pid : 4461  tag : LIST_SCROLL_BOOSTER@3

Answer 1:

我在设备之间看到的唯一区别是Android版本。 Android 4.4的引入,以使整个系统更光滑,即使在低的存储器设备的变化。

在这里,你有更多的细节: https://developer.android.com/about/versions/kitkat.html#svelte

它可能不是非常有帮助,但如果版本,它是唯一性差异,可能是。



Answer 2:

调查的几个星期后,原因是令人难以置信:这个问题是从含有太大的列表视图(几乎2MB)的布局根的背景图像而引起的。 虽然我知道,使用大的图像作为背景是不是一个好的做法,我实在不明白为什么一个高性能的设备上这是导致问题和-高性能较少的设备上一切都运行完美!

顺便说一句,我希望这将有助于我有同样的问题,任何人



文章来源: Android listview behave differently on same kind of device