Cómo agregar ListView en la codificación

Puedes hacerlo de esta manera:

Diseño de fragmentos (fragment_layout.xml):


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView" />

.

Su fragmento:

public class YourFragment extends Fragment {

@Override public View onCreateView (inflador LayoutInflater, contenedor ViewGroup,
Paquete salvadoInstanceState) {
View view = inflater.inflate (R.layout.fragment_layout, contenedor, falso);

ListView listView = (ListView) view.findViewById (R.id.textView);

vista de retorno;
}

}