I\'ve got a view that is effectively is a button. Here is its XML layout (add_new.xml)
header_layout.xml:
java code:
LayoutInflater mInflater =(LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View outerView = mInflater.inflate(R.layout.header_layout, null);
mHeaderView = (LinearLayout) outerView.findViewById(R.id.mHeaderView);
use mHeaderView.setVisiable() to control visiable not the outerView.setVisiable(). it works for me.