I am struggling to get a list view to be able to scroll. As far as I've read, it should be okay for a list V inside a linear layout, so it is not scrolling?
This is the layout
& lt; FrameLayout android: Id = "@ android: id / tabcontent" Android: layout_width = "match_parent" Android: layout_height = "wrap_content" & gt; & Lt; LinearLayout Android: id = "@ + id / tab2" Android: layout_width = "match_parent" Android: layout_height = "wrap_content" & gt; & Lt; ListView Android: id = "@ + id / listView1" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" & gt; & Lt; / ListView & gt; & Lt; / LinearLayout & gt; & Lt; Layout = "layout / tab3" /> & Lt; Layout = "@ layout / tab1" /> & Lt; / FrameLayout & gt; And here's where I fill it with stuff .. folder = new file (EnvironmentalGetInstanceStorage directory). GetPath ( ) + "/ Download /"); File [] listOfFiles = folder.listFiles (); ArrayAdapter & LT; String & gt; Arrayadp = New Array Adapter & lt; String & gt; (This, R.layout.list_files); (File file: listOfFiles) {if (file.isFile ()) {string extension = ""; String file name = file.getName (); Int i = filename.lastIndexOf ('.'); If (i> gt; 0) {extension = filename.substring (i + 1); } If (extension.equalsIgnoreCase ("wav")) {arrayadp.add (filename); }}} List View List = View (List View) Search ViewById (R.id.listView1); ListView.setAdapter (arrayadp);
attribute is required for a linearLayout . You have to set it to horizontal or vertical , even if there is only one child in LinearLayout I think this is the cause of your problem Can; I have forgotten the orientation many times and it can cause strange problems in how your views are displayed and behave. Here you will not consider using FrameLayout as your root view You may want to do this because many kids can have a FrameLayout with them properly if you want your three children in a horizontal or vertical line, then linear layout On Consider.
No comments:
Post a Comment