I am trying to create an overlay that acts as a small media player.
I have created a new activity that uses a theme that makes its background transparent (well-transparent).
But I have problems while talking about layout.
Overlay currently looks like this:
< P> I am trying to focus the media player box (white square) vertically and (vertical) is as small as possible. I am currently trying to achieve this in a linear rhythm by the layout of the vertical box with two empty scenes.
Current code:
& Lt; RelativeLayout Android: layout_width = "match_parent" Android: layout_height = "wrap_content" Android: layout_weight = "1" android: background = "# CCFFFFFF" android: id = "@ + id / overlay_layout" & gt; & Lt; LinearLayout Android: layout_width = "match_parent" Android: layout_height = "wrap_content" Android: Orientation = "horizontal" Android: id = "@ + ID / overlay_fstro" & gt; & Lt; ImageButton Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" android: id = "@ + id / overlay_playbutton" android: src = "@ android: drawable / ic_media_play" android: background = "@ null" / & gt; & Lt; SeekBar Android: layout_width = "match_parent" Android: layout_height = "wrap_content" android: id = "@ + ID / overlay_subbar" /> & Lt; / LinearLayout & gt; & Lt; TextView android: Layout_width = "Match_parent" Android: Layout_height = "Match_parent" Android: layout_below = "@ + id / overlay_firstrow" Android: layout_alignParentLeft = "true" android: id = "@ + id / overlay_text" android: text = "filename "/> & Lt; / RelativeLayout & gt; & Lt; See Android: layout_width = "match_parent" Android: layout_height = "match_parent" android: layout_weight = "1" /> & Lt; / LinearLayout & gt;
I know that the current code is not working (because I've given both the blank view and linear weight of 1 - hence the middle box takes up one-third of the screen height)
But I do not know how to do this correctly. My goal is that the smaller the middle box is as small, while the two outer (blank) scenes take equal space in the remaining parts.
I hope someone can help me.
In advance,
Uriel
There were problems:
The relative layout should not have a weight of 1, because it is the same which divides evenly into the total height 3. When you specify weight of 1 or more, set the height (in this case) to zero, besides, your text was set to match_parent
It was the man who took all the space.
& lt; View Android: layout_width = "match_parent" Android: layout_height = "0dp" Android: layout_weight = "1" /> & Lt; RelativeLayout Android: layout_width = "match_parent" Android: layout_height = "wrap_content" android: background = "# CCFFFFFF" android: id = "@ + id / overlay_layout" & gt; & Lt; LinearLayout Android: layout_width = "match_parent" Android: layout_height = "wrap_content" Android: Orientation = "horizontal" Android: id = "@ + ID / overlay_fstro" & gt; & Lt; ImageButton Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" android: id = "@ + id / overlay_playbutton" android: src = "@ android: drawable / ic_media_play" android: background = "@ null" / & gt; & Lt; SeekBar Android: layout_width = "match_parent" Android: layout_height = "wrap_content" android: id = "@ + ID / overlay_subbar" /> & Lt; / LinearLayout & gt; & Lt; TextView android: Layout_width = "Match_parent" Android: Layout_height = "Wrap_content" Android: layout_below = "@ + id / overlay_firstrow" Android: layout_alignParentLeft = "true" android: id = "@ + id / overlay_text" android: text = "filename "/> & Lt; / RelativeLayout & gt; & Lt; View Android: layout_width = "match_parent" Android: layout_height = "0dp" Android: layout_weight = "1" />
Comments
Post a Comment