android - Why can't ListView be top level view? -
so create fragment contains single listview, must do
<framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivityfragment"> <listview android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="match_parent"/> </framelayout>
why have place listview inside framelayout? why can't listview top level view?
update
i kind of asked question wrong: meant is: why not best practice make listview top level view? see framelayout wrapper in online codes.
it can, long don't expect put else in layout.
framelayout, same linear , relative, containers several views, if have 1 don't need them.
most layout files seen online assume may want expand on ui adding necessities empty state or fab. empty state needs on same layout too.
Comments
Post a Comment