2016-06-30 13 views
0

Hier ist meine XML:Artikel auf Android erscheinen Toolbar

<?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" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/activity_sign_up" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.mastermindcorp.alibdeir.salawat.signUpActivity" 
    android:background="@drawable/pattern"> 
<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/LL"> 
    <android.support.v7.widget.Toolbar 
     android:id="@+id/my_toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="@color/colorPrimary" 
     android:elevation="4dp" 
     android:theme="@style/ThemeOverlay.AppCompat.ActionBar" 
     app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> 
</LinearLayout> 
<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_below="@id/LL"> 
    <EditText 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:inputType="textEmailAddress" 
     android:ems="10" 
     android:id="@+id/emailET" 
     android:hint="@string/email" 
     style="@style/Widget.AppCompat.EditText" 
     android:maxLines="1" 
     android:layout_centerVertical="true" 
     android:layout_centerHorizontal="true" 
     android:drawableLeft="@drawable/ic_send_black_24dp" 
     android:paddingLeft="10dp" 
     android:paddingRight="10dp"/> 

</RelativeLayout> 

</RelativeLayout> 

Und hier ist, wie es zeigt:

Java:

Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar); 
setSupportActionBar(myToolbar); 

Wie Sie, die sehen Text ist in der Symbolleiste und der EditText fehlt. Das ist extrem irritierend. Ich habe viele Dinge ausprobiert und alle durchsucht, und ich konnte nichts finden.

+0

Das liegt daran, dass Ihr RelativeLayout mit Ihren Elementen über Ihrem LinearLayout liegt – 0xDEADC0DE

+0

Verwenden Sie LinearLayout als übergeordnetes Layout. – jaibatrik

Antwort

0

Ich löste es durch die LinearLayout zu entfernen, die die Toolbar Wraps und Einstellung RelativeLayout meine Inhalte der mit android:layout_below="@id/toolbar" unterhalb der Symbolleiste zu sein.

0

Lineares Layout wie andere sagt Arbeit auch, aber Sie können auch versuchen, wenn dies funktioniert.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:id="@+id/activity_sign_up" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.mastermindcorp.alibdeir.salawat.signUpActivity" 
android:background="@drawable/pattern"> 
<android.support.v7.widget.Toolbar 
    android:id="@+id/my_toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="?attr/actionBarSize" 
    android:background="@color/colorPrimary" 
    android:elevation="4dp" 
    android:theme="@style/ThemeOverlay.AppCompat.ActionBar" 
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> 
<EditText 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:inputType="textEmailAddress" 
    android:ems="10" 
    android:layout_below="@id/my_toolbar" 
    android:id="@+id/emailET" 
    android:hint="@string/email" 
    style="@style/Widget.AppCompat.EditText" 
    android:maxLines="1" 
    android:layout_centerVertical="true" 
    android:layout_centerHorizontal="true" 
    android:drawableLeft="@drawable/ic_send_black_24dp" 
    android:paddingLeft="10dp" 
    android:paddingRight="10dp"/> 

</RelativeLayout>