1. 程式人生 > >ListView中根據手機螢幕高度動態設定只顯示一螢幕的item個數

ListView中根據手機螢幕高度動態設定只顯示一螢幕的item個數

        int contentTop = activity.getWindow().findViewById(Window.ID_ANDROID_CONTENT).getTop();
        int titleBarHeight = contentTop - statusBarHeight;
        return statusBarHeight + titleBarHeight;
    }