Ich habe ein XML-Layout in einer zweiten Aktivität, die eine von zwei LinearLayouts
basierend darauf zeigt, ob ein Benutzer angemeldet ist oder nicht, und die TextView
Ich habe nie den Text angezeigt in der App, aber es macht es richtig, wenn ich auf die "Design" -Panel im Layout-EditorTextView zeigt auf Design-Vorschau, aber nicht in tatsächlichen Android-App
Die TextView
ist da (wenn ich eine Hintergrundfarbe, zeigt es diese Farbe), aber der Text selbst wird nie gerendert .
einen Knopf auf MainActivity
Ergebnisse Durch Klicken auf die LoginActivity
in starten, die die onCreate
hat (es ist Kotlin):
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.login_layout)
und Layout:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone"
android:id="@+id/loggedOut"
android:padding="24dp">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/passName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:focusable="true"
android:hint="Username"
android:inputType="textCapCharacters" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/passPin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:focusable="true"
android:hint="PIN"
android:inputType="numberPassword" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="@+id/passSubmit"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login" />
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/loggedIn"
android:visibility="visible"
android:padding="24dp">
<TextView
android:id="@+id/loggedInMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="You're currently logged in"
android:textAlignment="center"
android:textAppearance="@android:style/TextAppearance.Material.Headline" />
<Button
android:id="@+id/passLogout"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Logout" />
</LinearLayout>
</FrameLayout>
Dies ist, was Android Studio zeigt (diese Fehler sind TextInputLayout
Bugs, wo es sagt, dass es nicht finden kann, das Passwort Passwort-Symbol und so)
Bearbeiten zeigt: Ich habe alles in der Layout-Datei entfernt mit Ausnahme der TextView
und Eltern LinearLayout
und es zeigt immer noch nicht.
ich den 'TextInputLayout' die Frage, ob das war zu sehen, zu entfernen versuchte, keinen Wert hat. Während die Designwarnungen gelöscht wurden, bleibt das Problem bestehen – Parker
Was passiert, wenn Sie diese Zeile entfernen? Android: textAppearance = "@ android: style/TextAppearance.Material.Headline" /> '? –
Nein, gerade versucht, und tatsächlich sogar reduziert XML zu nur 'LinearLayout' und' TextView' – Parker