I am inflating a layout in
onCreateView() of the
Fragment,On the Activity created() of the
Fragment,I am retreving the data from the
DataBase and updating the values in the layout from the
DataBase which i inflated earlier.
LinearLayout main = null; if (rootView instanceof LinearLayout) main = (LinearLayout) rootView; main.removeAllViews(); LayoutInflater inflater = LayoutInflater.from(getActivity() .getApplicationContext()); View inflatedLayout = inflater .inflate(R.layout.nodata, null, false); if (main != null) main.addView(inflatedLayout);
Problem which i am facing is if I am getting no data,I am trying to inflate nodata XML(No
onActivityCreated() of the fragment by removing all the elements of rootView,NoDataXML is getting inflated,But UI Alignment is not happening,Layout is not occupying entire width of screen,it looks it
matchparent to width and height of nodataxml layout
Anyone knows standard way of dealing this problem.