在我的Android項目中,我只是試圖添加一個正常的Button
和一個ToggleButton
,以便它們可以水平並排。因此,我確保了水平方向並使用了權重和layout_weight
。但我得到的圖形佈局異常:在Android項目中添加ToggleButton導致異常
異常渲染期間提出:-1
異常詳細信息記錄在窗口>顯示視圖>錯誤日誌 和圖形佈局只有按鈕就可以可見。 任何幫助將不勝感激。
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:weightSum="100"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:layout_weight="20"
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button" />
<ToggleButton
android:layout_weight="80"
android:id="@+id/toggleButton1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="ToggleButton" /></LinearLayout>
發佈您的logcat異常。 – 2015-02-11 18:21:42