android - layout_weight not working with LinearLayout inside Drawerlayout -
I am struggling with LinearLayout while using drawer layout. This is using the Android Studio template for DrawerLayout:
& lt; android.support.v4.widget.DrawerLayout xmlns: android = "http://schemas.android.com/apk/res/ Android" xmlns: device = "http://schemas.android.com/tools" android: id = "@ + Id / drawer_layout" Android: layout_width = "match_parent" Android: layout_height = "match_parent" tool: reference = ". MyActivity" & gt; & Lt ;! - As the main content view, the views below use the available space using match_parent in both dimensions. - & gt; & Lt; LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: id = "" @ + id / container Android: layout_width = "match_parent" Android: layout_height = "match_parent" android: orientation = "Vertical" & gt; & Lt; Android: layout_height = "0dp" Android: layout_weight = "1" /> & Lt; LinearLayout Android: background = "# f00" Android: layout_width = "match_parent" Android: layout_height = "wrap_content" android: layout_weight = "0" & gt; & Lt; EditText Android: layout_width = "match_parent" android: layout_height = "wrap_content" android: layout_weight = "0" /> & Lt; / LinearLayout & gt; & Lt; / LinearLayout & gt; & Lt ;! - android: layout_gravity = "as the start" a sliding drawer to right languages from the left and tell the right-of-Dravar layout on the right side to left languages if the API does not build between 17 or more If so, use Android instead: layout_gravity = "left" - & gt; & Lt ;! - Drawer has been given a fixed width in DP and increases the height of the container - & gt; & Lt; Piece android: id = "@ + id / navigation_drawer" Android: layout_width = "@ Dimen / navigation_drawer_width" Android: layout_height = "match_parent" Android: layout_gravity = "start" android: name = "com.test.testdrawerlayout.NavigationDrawerFragment" tool : Layout = "@ layout / framt_navigation_drover" /> & Lt; /android.support.v4.widget.DrawerLayout>
As you can see, the layout_weight = "1" part is not exactly visible. When I create an empty project with the internal linear timepiece, the layout works (like the preview, with the red layout on top, most layout of the screen with blue layout).
Any thoughts really appreciated, because I am totally stumped right now thanks in advance.
It appears that I was using an old Android SDK platform. Once I went to SDK Manager and installed API 1, he (with a new project) worked.
Perhaps this was a bug in the old implementation?
Comments
Post a Comment