Code example for ListView

Methods: setLayerTypesetAdapter

    private void setupList(int listId) {
        final ListView list = (ListView) findViewById(listId);
        list.setAdapter(new SimpleListAdapter(this));
        list.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    private static class SimpleListAdapter extends ArrayAdapter<String> {
        public SimpleListAdapter(Context context) {
            super(context, android.R.layout.simple_list_item_1, DATA_LIST);
        public View getView(int position, View convertView, ViewGroup parent) {
            TextView v = (TextView) super.getView(position, convertView, parent);
            final Resources r = getContext().getResources();
            final DisplayMetrics metrics = r.getDisplayMetrics();
            v.setCompoundDrawablePadding((int) (6 * metrics.density + 0.5f));
Connect your IDE to all the code out there  Get Codota for Java