In android studio3.0 in Design Registern verteilen hat diese Art von Layout Relative Layout auf reales Gerät
aber auf reales Gerät Ich habe diesen Mist:
Was ich falsch gemacht? Bitte helfen Sie.
In android studio3.0 in Design Registern verteilen hat diese Art von Layout Relative Layout auf reales Gerät
aber auf reales Gerät Ich habe diesen Mist:
Was ich falsch gemacht? Bitte helfen Sie.
das Layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay"
android:id="@+id/view">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_add_todo"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
</android.support.design.widget.AppBarLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/view"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<!--task label-->
<TextView
android:id="@+id/TitleLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:focusableInTouchMode="true"
android:text="@string/title_string"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorAccent"
android:textSize="@dimen/label_size"/>
<EditText
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/TitleLabel"
android:hint="@string/enter_title_string"
android:inputType="textShortMessage"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge"/>
<requestFocus />
<!-- Description -->
<TextView
android:id="@+id/DescriptionLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:text="@string/description_string"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorAccent"
android:textSize="@dimen/label_size"/>
<EditText
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/DescriptionLabel"
android:hint="@string/enter_description_string"
android:inputType="textEmailAddress|textMultiLine"
android:lines="10"
android:minLines="2"
android:scrollbars="vertical"
android:singleLine="false"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge">
</EditText>
<!--Deadline time-->
<!-- Time and Date -->
<TextView
android:id="@+id/time_and_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/description"
android:text="@string/time_and_date_string"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorAccent" />
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/time_and_date"
android:layout_toRightOf="@+id/time_and_date"
android:layout_marginLeft="10dp"
android:text="@string/no_date_set_string"
android:textColor="@color/colorAccent"
android:textSize="20dp" />
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/time_and_date"
android:layout_toRightOf="@+id/date"
android:layout_marginLeft="50dp"
android:text="@string/no_time_set_string"
android:textColor="@color/colorAccent"
android:textSize="20dp" />
<Button
android:id="@+id/date_picker"
style="@style/AppTheme.AppBarOverlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/date"
android:layout_toRightOf="@+id/time_and_date"
android:textSize="15sp"
android:text="@string/choose_date_string" />
<Button
android:id="@+id/time_picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/date"
android:layout_below="@id/time"
android:textSize="15sp"
android:text="@string/choose_time_string" />
<TextView
android:id="@+id/alarm_me"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/time_and_date"
android:layout_below="@+id/date_picker"
android:layout_marginTop="15dp"
android:text="@string/alarm_me_string"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorAccent" />
<CheckBox
android:id="@+id/alarmCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/alarm_me"
android:layout_toEndOf="@+id/DescriptionLabel"
android:hint="@string/alarm_hint"
android:textColor="@color/colorPrimaryDark"></CheckBox>
<TextView
android:id="@+id/complete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/alarm_me"
android:layout_alignStart="@+id/alarm_me"
android:layout_below="@+id/alarm_me"
android:layout_marginTop="15dp"
android:text="@string/complete_string"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorAccent" />
<CheckBox
android:id="@+id/completeCheckBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/complete"
android:layout_alignStart="@+id/alarmCheckBox"
android:layout_toEndOf="@+id/DescriptionLabel"
android:textColor="@color/colorPrimaryDark"></CheckBox>
<Button
android:id="@+id/cancelButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/completeCheckBox"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="30dp"
android:layout_toStartOf="@+id/completeCheckBox"
android:text="@string/cancel_string" />
<Button
android:id="@+id/submitButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/alarmCheckBox"
android:layout_alignTop="@+id/cancelButton"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="@string/submit_string" />
</RelativeLayout>
</RelativeLayout>
Warum haben Sie 'style =" @ style/AppTheme.AppBarOverlay "' für date_picker button? –
Ich könnte es ändern, aber ich konzentriere mich mehr auf Positionen meiner Elemente –
Stapel meinen Code zu blockieren. Veröffentlicht in Antwort. –
ok. Lass mich das überprüfen. Sie haben verschachtelte lineare Layouts erstellt. Vielleicht wissen Sie, warum die Art und Weise, wie ich sie gemacht habe, nicht mit dem relativen Layout funktioniert oder wo Sie darüber lesen können. –