【发布时间】:2011-06-09 02:20:28
【问题描述】:
我遇到了切换按钮的奇怪问题。我想将它们水平居中并使用相对布局将它们放在另一个下方。
但是无论我做什么 - 他们总是并排结束
有什么想法吗?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg7"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:id="@+id/spacer"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:text=" ">
</TextView>
<TableRow android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/spacer"
android:paddingTop="5dip"
android:paddingBottom="10dip"
android:gravity="center">
<ToggleButton android:id="@+id/ShowNotification"
android:onClick="switchNotification"
android:textOn="Show Notification"
android:layout_width="220dip"
android:layout_height="50dip"
android:layout_above="@+id/UpdateLog"
android:textOff="No Notification"/>
<ToggleButton android:id="@+id/UpdateLog"
android:layout_width="220dip"
android:layout_height="50dip"
android:onClick="swtichLogging"
android:textOn="Log"
android:textOff="Don't Log"/>
</TableRow>
</RelativeLayout>
提前致谢
【问题讨论】:
标签: android user-interface button toggle android-relativelayout