In my fragment class, I add a child view element programmatically to my layout conditionally :
LinearLayout child = (LinearLayout) inflater.inflate(R.layout.
I think you can simply use
findViewById(your_view_id)
method: If its result is null the view does not exists, otherwise the view is present