ListView listView = findViewById(R.id.list_view); listView.setPadding(16, 16, 16, 16);
DisplayMetrics displayMetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); int screenWidth = displayMetrics.widthPixels; int padding = screenWidth / 2; ListView listView = findViewById(R.id.list_view); listView.setPadding(padding, padding, padding, padding);These examples use the java.android.widget.ListView class, which is part of the Android SDK.