Ein Layout definiert die visuelle Struktur für eine Benutzeroberfläche, z. B. die Benutzeroberfläche für eine Aktivität, ein Fragment oder ein App-Widget.
Warum wird FOOBARZ ganz unten angeordnet, wenn keine Elemente vorhanden sind layout_height="fill_parent", dh alle Elemente sind wrap_content für die Höhe? <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/feed_u" android:layout_width="50dip" android:layout_height="50dip" android:layout_marginLeft="5dip" android:scaleType="centerCrop" android:drawableTop="@android:drawable/presence_online" android:text="U" /> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/feed_u"> <ImageView android:id="@+id/feed_h" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/btn_minus" /> <ImageView android:id="@+id/feed_ha" …
<EditText android:id="@+id/editText2" android:layout_height="wrap_content" android:layout_width="fill_parent" android:maxLines="5" android:lines="5"> </EditText> Der Benutzer kann mehr als 5 Zeilen eingeben, indem er die Eingabetaste / die nächste Zeilentaste drückt. Wie kann ich Benutzereingaben mit EditText auf eine feste Anzahl von Zeilen beschränken?
Ich kämpfe darum, das Konzept zu verstehen, dass es fitsSystemWindowsje nach Ansicht unterschiedliche Dinge bewirkt. Laut offizieller Dokumentation ist es ein Boolesches internes Attribut zum Anpassen des Ansichtslayouts basierend auf Systemfenstern wie der Statusleiste. Wenn true, wird der Abstand dieser Ansicht angepasst , um Platz für die Systemfenster zu lassen …
Ich habe ein Fragment mit enthält eine RecyclerView mit layout_width = "match_parent": <android.support.v7.widget.RecyclerView 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:layout_gravity="center" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity$PlaceholderFragment" /> Das Element in der RecyclerView ist eine CardView, ebenfalls mit layout_width = "match_parent": <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_gravity="center" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="20dp" card_view:cardCornerRadius="4dp"> <TextView android:layout_gravity="center" android:id="@+id/info_text" android:layout_width="match_parent" …
Gibt es eine Möglichkeit, die Höhe / Breite eines LayoutParams als dichteunabhängige Pixel (dp) festzulegen ? Es sieht so aus, als ob die Höhe / Breite, wenn sie programmgesteuert eingestellt wird, in Pixel und nicht in dp angegeben ist.
Ich habe bisher ungefähr 6 Stunden damit verbracht und nichts als Straßensperren getroffen. Die allgemeine Voraussetzung ist, dass eine Zeile ListView(unabhängig davon, ob sie vom Adapter generiert oder als Header-Ansicht hinzugefügt wird) eine Zeile enthält, die ein EditTextWidget und ein enthält Button. Alles, was ich tun möchte, ist, den Jogball …
Wenn ich VectorDrawable-Assets in einer Text- oder Bildansicht verwende, tritt bei Verwendung von "android: DrawableRight" / "android: DrawableEnd" / "android: DrawableStart" / "android: DrawableLeft" ein Laufzeitabsturz auf. Die App wird ohne Warnungen problemlos kompiliert. ich benutze Gradle 1.5 Support Library 23.2 ('com.android.support:appcompat-v7:23.2.0') Was ich jedoch festgestellt habe, ist, dass ich …
Nach dem Update von Android Studio von 2.3 auf 3.0 habe ich buildToolsVersionvon 26.0.0 auf 26.0.2 gewechselt und danach erhalte ich folgende Fehlermeldung: Cannot resolve symbol '?attr/actionBarSize XML-Code: <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="@color/colorPrimary" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:titleTextColor="@android:color/white"/> Abhängigkeiten: compile 'com.android.support:appcompat-v7:26.1.0' compile 'com.android.support:design:26.1.0'
Ich möchte dies (die Seitennavigation) wirklich in einer eigenen App implementieren. Weiß jemand, wie Google dies geschafft hat? Sie scheinen das aktuelle Fenster beiseite gezogen und eine eigene Fly-In-Navigation eingerichtet zu haben.
Ich möchte einen Android-Button mit Symbol + Text in der Mitte haben. Ich verwende das Attribut drawableLeft, um das Bild festzulegen. Dies funktioniert gut, wenn die Schaltfläche eine Breite von hat "wrap_content", ich mich jedoch auf die maximale Breite dehnen muss, damit ich die Breite verwende "fill_parent". Dadurch wird mein …
Was ist der wesentliche Unterschied zwischen diesen beiden Methoden? Sollte ich beim Erstellen einer Textansicht eine für die Leistung übereinander verwenden? Bearbeiten: Was ist der Unterschied zu onCreateView() { root = some view View v = new View(some context); root.add(v); return root; } onViewCreated() { View v = new View(some …
In meine Layout-XML-Datei habe ich eine andere Layout-XML-Datei aufgenommen (jede mit einer anderen Android-ID). <include layout="@layout/view_contact_name" android:id="+id/test1"/> <include layout="@layout/view_contact_name" android:id="+id/test2"/> Aber wenn ich es im Emulator ausführe und den Hierarchy Viewer starte, zeigt jedes Layout immer noch 'NO_ID' an, und in meinem Code habe ich findViewById(R.id.test1)undfindViewById(R.id.test2) beide geben null zurück. …
Der Hintergrund der Symbolleiste hat eine dunkle Farbe. Ich möchte, dass Text und Pfeil nach hinten weiß sind. Ich habe versucht zu folgen, aber es funktioniert nicht. <style name="Theme.MyTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/blue</item> <item name="colorPrimaryDark">@color/blue_darker</item> <item name="colorAccent">@color/purple</item> <!-- item name="android:textColorPrimary">@color/white</item--> // I don't want to set this, changes everywhere. <item name="android:textColorSecondary">@color/white</item> …
We use cookies and other tracking technologies to improve your browsing experience on our website,
to show you personalized content and targeted ads, to analyze our website traffic,
and to understand where our visitors are coming from.
By continuing, you consent to our use of cookies and other tracking technologies and
affirm you're at least 16 years old or have consent from a parent or guardian.