 <p>I fixed it this way: I created an xml layout for my listview (list_layout.xml) with id "list" and another xml layout for my header (header_layout.xml). Then in my fragment in onCreateView did this:</p> <pre><code> View v = inflater.inflate(R.layout.list_layout, container, false); ListView listView= (ListView) v.findViewById(R.id.list); View header = inflater.inflate(R.layout.header_layout,listView, false); listView.addHeaderView(header, null, false); adapter = new Adapter... listView.setAdapter(adapter); //lets say you have a text view in your header. This is how you set it //pay attention how used **header** NOT v as the view Name_textview=(TextView) header.findViewById(R.id.photo_number); </code></pre>