Ich versuche, eine App mit einer Aktionsleiste, schwebenden Knopf und ListView
zu machen.Android: ListView hat seltsame Ränder
Wenn ich die ListView
in Android Studio hinzufügen, hat es immer große Ränder zu allen Seiten.
Was ich in der Layout-Code ändern sie es hilft nicht immer sieht wie folgt aus:
Mein Layout-Code wie folgt aussieht:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="appenzeller.de.glimpse.MainActivity">
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/mainList" />
<LinearLayout
android:id="@+id/ly_bar_bottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="right"
android:orientation="horizontal">
<android.support.design.widget.FloatingActionButton
android:id="@+id/button_addc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="28dp"
android:src="@drawable/ic_add_white_18dp"
android:onClick="addNewEntry"
app:borderWidth="0dp"
app:elevation="6dp"
app:pressedTranslationZ="12dp" />
</LinearLayout>
</RelativeLayout>
Was mache ich falsch?
Bitte geben Sie die gesamte Datei mit Root Artikel anzeigen Ich würde annehmen, dass es die Standardübergabe/Marge hat. Und die Breite der Listenansicht ist auf "wrap_content" eingestellt, die Sie wahrscheinlich "match_parent" möchten. –
hat es aktualisiert - es fehlte vor dem Entschuldigen – arnoapp
Entfernen Sie ** Padding-Zeilen aus Ihrem Root-Layout **. d. h. Entfernen Sie 'android: paddingLeft =" @ dimen/activity_horizontal_margin "' und alle anderen .. !! –