Android 导致应用程序崩溃的布局
因此,我一直在尝试更改我的几个XML中的布局,但由于某种原因,当我更改这个布局时,它会使应用程序崩溃。新布局如下所示:Android 导致应用程序崩溃的布局,android,xml,layout,Android,Xml,Layout,因此,我一直在尝试更改我的几个XML中的布局,但由于某种原因,当我更改这个布局时,它会使应用程序崩溃。新布局如下所示: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient_bg" >
<RelativeLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:gravity="center" >
</RelativeLayout>
<!-- Footer aligned to bottom -->
<RelativeLayout
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/ButtonOK"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_toLeftOf="@+id/ButtonAll"
android:text="Go"
style="@style/btnStyleBreakerBay"/>
<Button
android:id="@+id/ButtonAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="See All"
android:layout_toRightOf="@+id/ButtonOK"
android:layout_toLeftOf="@+id/ButtonBack"
style="@style/btnStyleBreakerBay"/>
<Button
android:id="@+id/ButtonBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Back"
android:layout_toRightOf="@+id/ButtonAll"
style="@style/btnStyleBreakerBay"/>
</RelativeLayout>
<ScrollView
android:id="@+id/scrollableContents"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/footer"
android:layout_below="@id/header" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView android:id="@+id/typeEvent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Type of Event:"
android:visibility="gone"
style="@style/black_text"/>
<Spinner
android:id="@+id/spinner_search_event"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/event_search_arrays"
android:prompt="@string/event_prompt"
android:visibility="gone"
android:popupBackground="#31535c"/>
<!-- Name Label -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Type of Pavement:"
style="@style/black_text"/>
<Spinner
android:id="@+id/spinner_search_pavement"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/pave_search_arrays"
android:prompt="@string/pavement_prompt"
android:popupBackground="#31535c" />
<!-- Name Label -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Amount of Traffic:"
style="@style/black_text"/>
<Spinner
android:id="@+id/spinner_search_traffic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/traffic_search_arrays"
android:prompt="@string/traffic_prompt"
android:popupBackground="#31535c"/>
<!-- Name Label -->
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Type of Environment:"
style="@style/black_text"/>
<Spinner
android:id="@+id/spinner_search_enviro"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/enviro_search_arrays"
android:prompt="@string/enviro_prompt"
android:popupBackground="#31535c"/>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Max Miles away from you:"
style="@style/black_text"/>
<Spinner
android:id="@+id/spinner_dist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/dist_arrays"
android:prompt="@string/dist_prompt"
android:popupBackground="#31535c"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
还有几条红线,但我认为这是最主要的。现在我想这与我在@+id/footer中的按钮有关,那么我该如何解决这个问题呢
提前谢谢大家,
泰勒
android:layout\u-toLeftOf=“@+id/ButtonAll”
和android:layout\u-toRightOf=“@+id/ButtonOK”
建立循环依赖关系。
android:layout\u-toLeftOf=“@+id/ButtonAll”
和android:layout\u-toRightOf=“@+id/ButtonOK”
建立一个循环依赖关系。为了让事情清楚,你可以在这里检查我的答案,为了让事情清楚,你可以在这里检查我的答案谢谢你,我摆脱了android:layout\u-toLeftOf=“@+id/ButtonAll”和android:layout\toLeftOf=“@+id/ButtonBack”但是现在ButtonOk没有出现。谢谢你,我去掉了android:layout_toLeftOf=“@+id/ButtonAll”和android:layout_toLeftOf=“@+id/ButtonBack”,但是现在ButtonOk没有出现。
02-12 06:58:05.351: E/AndroidRuntime(2367): java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout
<Button
android:id="@+id/ButtonOK"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_toLeftOf="@+id/ButtonAll"
android:text="Go"
style="@style/btnStyleBreakerBay"/>
<Button
android:id="@+id/ButtonAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="See All"
android:layout_toRightOf="@+id/ButtonOK"
android:layout_toLeftOf="@+id/ButtonBack"
style="@style/btnStyleBreakerBay"/>