Create text for empty listView

Categories: ANDROID like

RelativeLayout lContainerLayout = new RelativeLayout(this); lContainerLayout.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT)); TextView textView = new TextView(this); textView.setText(“List is empty!”); RelativeLayout.LayoutParams lButtonParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); lButtonParams.addRule(RelativeLayout.CENTER_IN_PARENT); textView.setLayoutParams(lButtonParams); lContainerLayout.addView(textView); addContentView(lContainerLayout, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT)); listView.setEmptyView(lContainerLayout);