android - Button alignment improper in Table Layout after adding "fourth" button -
something wrong tablelayout. not able display 4 buttons properly. want circle badge shown above text , not on text.
how correct this. in advance!!
button layout :
<linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" > <tablelayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_centerinparent="true" android:gravity="bottom" > <tablerow android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#092435" android:gravity="center_horizontal" > <button android:id="@+id/btnmanuallookup" android:layout_width="0dp" android:layout_weight="1" android:background="#4982ae" android:gravity="center" android:padding="10dip" android:text="button one" android:textcolor="#ffffff" /> <view android:layout_width="1dp" android:layout_height="match_parent" android:layout_marginbottom="6dip" android:layout_margintop="6dip" android:background="#85929b" /> <button android:id="@+id/supportbutton" android:layout_width="0dp" android:layout_weight="1" android:background="#092435" android:gravity="center" android:padding="10dip" android:text="button two" android:textcolor="#ffffff" /> <view android:layout_width="1dp" android:layout_height="match_parent" android:layout_marginbottom="6dip" android:layout_margintop="6dip" android:background="#85929b" /> <button android:id="@+id/messagebutton" android:layout_width="0dp" android:layout_weight="1" android:background="#092435" android:gravity="center" android:padding="10dip" android:text="button three" android:textcolor="#ffffff" /> <view android:layout_width="1dp" android:layout_height="match_parent" android:layout_marginbottom="6dip" android:layout_margintop="6dip" android:background="#85929b" /> <relativelayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <button android:id="@+id/survey" android:background="#092435" android:text="button four" android:layout_weight="1" android:padding="10dip" android:gravity="center" android:textcolor="#ffffff" android:layout_width="65dip" android:layout_height="65dip" /> <textview android:id="@+id/textone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignright="@id/survey" android:layout_aligntop="@id/survey" android:background="@drawable/badge_circle" android:text="10" android:textcolor="#fff" android:textsize="16sp" android:textstyle="bold" /> </relativelayout> </tablerow> </tablelayout> </linearlayout>
badge_circle.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <corners android:radius="10dip"/> <solid android:color="#f00"/> <stroke android:width="2dip" android:color="#fff"/> <padding android:left="5dip" android:right="5dip" android:top="5dip" android:bottom="5dip"/> </shape>
add android:layout_weight="1"
relativelayout fourth button.
<linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" > <tablelayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_centerinparent="true" android:gravity="bottom" > <tablerow android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#092435" android:gravity="center_horizontal" > <button android:id="@+id/btnmanuallookup" android:layout_width="0dp" android:layout_weight="1" android:background="#4982ae" android:gravity="center" android:padding="10dip" android:text="button one" android:textcolor="#ffffff" /> <view android:layout_width="1dp" android:layout_height="match_parent" android:layout_marginbottom="6dip" android:layout_margintop="6dip" android:background="#85929b" /> <button android:id="@+id/supportbutton" android:layout_width="0dp" android:layout_weight="1" android:background="#092435" android:gravity="center" android:padding="10dip" android:text="button two" android:textcolor="#ffffff" /> <view android:layout_width="1dp" android:layout_height="match_parent" android:layout_marginbottom="6dip" android:layout_margintop="6dip" android:background="#85929b" /> <button android:id="@+id/messagebutton" android:layout_width="0dp" android:layout_weight="1" android:background="#092435" android:gravity="center" android:padding="10dip" android:text="button three" android:textcolor="#ffffff" /> <view android:layout_width="1dp" android:layout_height="match_parent" android:layout_marginbottom="6dip" android:layout_margintop="6dip" android:background="#85929b" /> <relativelayout android:layout_width="0dp" android:layout_weight="1" android:layout_height="fill_parent" > <button android:id="@+id/survey" android:background="#092435" android:text="button four" android:padding="10dip" android:gravity="center" android:textcolor="#ffffff" android:layout_width="65dip" android:layout_height="65dip" /> <textview android:id="@+id/textone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignright="@id/survey" android:layout_aligntop="@id/survey" android:background="@drawable/badge_circle" android:text="10" android:textcolor="#fff" android:textsize="16sp" android:textstyle="bold" /> </relativelayout> </tablerow> </tablelayout> </linearlayout>
Comments
Post a Comment