我目前在使用Android
次观看时遇到问题。
我使用NavigationDrawer
并且知道我无法在RelativeLayout
中使用保证金来获取元素之间的空格
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.cardio.MainActivity" >
<!--
As the main content view, the view below consumes the entire
space available using match_parent in both dimensions.
-->
<FrameLayout
android:id="@+id/search_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Spinner
android:id="@+id/hersteller"
android:layout_alignParentTop="true"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_marginStart="30dp" />
<Spinner
android:id="@+id/modell"
android:layout_alignParentTop="true"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_below="@id/hersteller"
android:layout_marginStart="30dp"
android:layout_marginTop="50dp"
android:clickable="false"
android:longClickable="false" />
<SeekBar
android:id="@+id/preisSB"
android:layout_alignParentTop="true"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_below="@id/modell"
android:layout_marginStart="30dp"
android:layout_marginTop="150dp" />
<EditText
android:id="@+id/preisET"
android:layout_alignParentTop="true"
android:layout_width="60dp"
android:layout_height="50dp"
android:layout_toEndOf="@id/preisSB"
android:layout_below="@id/modell"
android:layout_marginTop="100dp"
android:layout_marginStart="0dp" />
<EditText
android:id="@+id/leistung"
android:layout_alignParentTop="true"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_below="@id/preisSB"
android:layout_marginTop="150dp"
android:layout_marginStart="30dp" />
</RelativeLayout>
</FrameLayout>
<!--
android:layout_gravity="start" tells DrawerLayout to treat
this as a sliding drawer on the left side for left-to-right
languages and on the right side for right-to-left languages.
If you're not building against API 17 or higher, use
android:layout_gravity="left" instead.
-->
<!--
The drawer is given a fixed width in dp and extends the full height of
the container.
-->
<ListView
android:id="@+id/navigation_drawer"
android:background="#FFFF10"
android:name="com.example.cardio.NavigationDrawerFragment"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
tools:layout="@layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>
我已经有了其他看起来大致相似的布局,但我找不到我的新布局无法工作的原因。
希望你们能帮帮我。
现在的样子: