android - Circular Buttons in LinearLayout:Vertical -
i have created own drawable object, setting background of image button. (described here)
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="#a7bf1d"/> </shape>
i want these spaced equally vertically down side of screen, want use android:layout_weight achieve this. (described here)
<linearlayout android:id="@+id/left_bar" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="8"> <button android:id="@+id/btncall" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="1" android:background="@drawable/btn_circle" android:text="call" android:textsize="12sp" /> <space android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="1"></space> <button android:id="@+id/btnspeak" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="1" android:background="@drawable/btn_circle" android:text="speak" android:textsize="12sp" /> <space android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="1"></space> <button android:id="@+id/btnrecordedmessage" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="1" android:background="@drawable/btn_circle" android:text="recorded message" android:textsize="12sp" /> <space android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="1"></space> <button android:id="@+id/btnselectall" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="1" android:background="@drawable/btn_circle" android:text="select units" android:textsize="12sp" /> <space android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="1"></space> <button android:id="@+id/btndeselectunits" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="1" android:background="@drawable/btn_circle" android:text="deselect units" android:textsize="12sp" /> <space android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="1"></space> <button android:id="@+id/btnanswer" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="1" android:background="@drawable/btn_circle" android:text="answer" android:textsize="12sp" /> </linearlayout>
what ever cannot seem have them spaced out equally on screen size let alone scaled each of them. think issue have specify height & width form circle, messes layout_weight been (for want of better term) 'hardcoded'.
i assume possible have vertical layout of 6 circular buttons, spaced equally down screen cannot work out how? have tried without <space>
, , added padding <button>
instead.
well. one, layout_widths in linearlayouts children set match_parent. after first child renders, there won't room else because take space.
secondly, highly suggest against using tags. instead set padding (or margins) buttons.
Comments
Post a Comment