Android 无法保存哪个视图具有焦点?
我的应用程序包含“设置”活动,其中包含两个图像按钮“返回”和“关于”,每当我按下这些按钮中的任何一个时,我都会得到: “无法保存具有焦点的视图,因为焦点视图为android.widget。LinearLayout@4055a9e0没有id“ my_设置的xml代码:Android 无法保存哪个视图具有焦点?,android,Android,我的应用程序包含“设置”活动,其中包含两个图像按钮“返回”和“关于”,每当我按下这些按钮中的任何一个时,我都会得到: “无法保存具有焦点的视图,因为焦点视图为android.widget。LinearLayout@4055a9e0没有id“ my_设置的xml代码: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/ll2"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="15" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layout_margin="8dp"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/settings" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|end"
android:orientation="horizontal" >
<ToggleButton
android:id="@+id/tb1"
android:layout_margin="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:text="@string/sett1" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/border2"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/ll_set_back"
android:layout_margin="3dp"
android:gravity="center"
android:layout_weight="1"
android:orientation="vertical" >
**<ImageButton
android:id="@+id/st_ibt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/action_btn"
android:src="@drawable/back_ic" />**
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/back"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/ll_set_about"
android:layout_margin="3dp"
android:gravity="center"
android:layout_weight="1"
android:orientation="vertical" >
**<ImageButton
android:id="@+id/st_ibt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/action_btn"
android:src="@drawable/about_ic" />**
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
那么,如何解决这个问题呢?我不明白这个错误是什么意思。。任何建议我认为问题在于:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:orientation="vertical" >
您启用了此线性布局的焦点,但没有为其提供任何id。我认为问题在于:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:orientation="vertical" >
您启用了此线性布局的焦点,但没有为其提供任何id。在scrollview中出现所有问题之后,我的错误:)。非常感谢@你救了我。一般来说,如果我不解决问题,我的应用会怎么样?毕竟问题出在scrollview上,呵呵,我错了:)。非常感谢@你救了我。一般来说,如果我不解决这个问题,我的应用会怎么样??