Android Wieso kann ich keine ListView mehr zum Layout hinzufügen?

Windows10

Bekanntes Mitglied
Ich habe von meiner Android App das Layout fertig, bekomme aber keine ListView mehr angezeigt in meiner MainActivity.

Mit Menü:
mit Menü.png


Ohne Menü:
ohne Menü.png

Auf die freie Fläche will ich noch eine ListView anzeigen und einen FloatingActionButton, aber irgendwie kommt der immer in den türkisen Berich oben hin und ist nicht verschiebbar (springt immer wieder nach oben) und die ListView wird überhaupt nicht angezeigt.

Weiß jemand was es da haben könnte?

Wenn ihr den Code oder die .xml-Dateien braucht bitte melden und sagen welche benötigt werden, da ich sonst alle gleich hinzufügen muss, was ziemlich viel werden könnte.

Danke für die Hilfe.
 

Windows10

Bekanntes Mitglied
activity_main.xml:
XML:
<?xml version="1.0" encoding="utf-8"?>
    <androidx.drawerlayout.widget.DrawerLayout 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/drawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/appBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbatHome"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textAlignment="center"
                app:contentInsetEnd="0dp"
                app:contentInsetStart="0dp"
                android:background="@color/colorAccent">
                <include layout="@layout/toolbar"/>
            </androidx.appcompat.widget.Toolbar>

    </com.google.android.material.appbar.AppBarLayout>

    <FrameLayout
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

    <com.google.android.material.navigation.NavigationView
    android:id="@+id/mDrawerLayout"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="false"
    android:layout_marginStart="30dp"
    app:headerLayout="@layout/header"
    app:menu="@menu/drawer_menu"
    app:itemTextColor="@color/colorPrimaryDark"/>

    </androidx.drawerlayout.widget.DrawerLayout>

header.xml:
XML:
<?xml version="1.0" encoding="utf-8"?>
    <androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
    android:layout_height="150dp"
    android:orientation="horizontal"
    android:padding="20dp"
    android:background="@color/colorPrimaryDark">
    <TextView
    android:id="@+id/userNameEditText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="18sp"
    android:layout_marginTop="24dp"
    android:text="@string/app_name"
    android:textColor="@android:color/white"
    android:textSize="16sp"
    android:textStyle="bold"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

toolbar.xml:
XML:
<?xml version="1.0" encoding="utf-8"?>

    <androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:layout_gravity="top" >

    <TextView
    android:id="@+id/toolbarTitle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textSize="20sp"
    android:gravity="center"
    android:clickable="true"
    android:focusable="true"
    android:layout_marginEnd="60dp"/>
</androidx.appcompat.widget.Toolbar>

MainActivity:
Java:
package ue.list.dotolist;

import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.drawerlayout.widget.DrawerLayout;

import android.os.Bundle;
import android.view.MenuItem;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.google.android.material.navigation.NavigationView;

import butterknife.BindView;

public class MainActivity extends AppCompatActivity {
    private DrawerLayout mDrawerLayout;
    private ActionBarDrawerToggle mToggle;
    @BindView(R.id.mDrawerLayout)
    NavigationView navigationView;
    @BindView(R.id.container)
    FrameLayout container;
    @BindView(R.id.toolbar)
    Toolbar myToolbar;
    @BindView(R.id.toolbarTitle)
    TextView toolbarTitle;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setupUi();
    }

    private void setupUi() {
        mDrawerLayout = findViewById(R.id.drawer);
        mToggle = new ActionBarDrawerToggle(this, mDrawerLayout, myToolbar, R.string.open, R.string.close);
        mDrawerLayout.addDrawerListener(mToggle);
        mDrawerLayout.setClickable(true);
        setSupportActionBar(myToolbar);
        mToggle.setDrawerIndicatorEnabled(true);
        mToggle.syncState();
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        if (mToggle.onOptionsItemSelected(item)) {
            return true;
        } else {
            return super.onOptionsItemSelected(item);
        }
    }
}

build.gradle:

Code:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "ue.list.dotolist"
        minSdkVersion 24
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
    implementation 'androidx.drawerlayout:drawerlayout:1.1.0'
    implementation 'com.google.android.material:material:1.2.0'
    implementation 'com.jakewharton:butterknife:10.2.3'
    implementation 'androidx.annotation:annotation:1.1.0'
    annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

}
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
A Wieso keine java - forum app Android & Cross-Platform Mobile Apps 4
W Wieso gehen Log nicht im Service? Android & Cross-Platform Mobile Apps 20
W Android Wieso geht getApplicationContext() bei Toast, aber nicht bei AlertDialog.Builder? Android & Cross-Platform Mobile Apps 36
A Wieso wird die App beendet ??? Android & Cross-Platform Mobile Apps 2
A Kann nicht in TextView einer anderen Klasse schreiben - wieso? Android & Cross-Platform Mobile Apps 9
N XY-Plottet keine Daten obwohl Funktion ausgeführt wird Android & Cross-Platform Mobile Apps 4
N XY-Plot plottet keine Daten Android & Cross-Platform Mobile Apps 0
W Android Kann keine ListView mehr in der MainActivtiy anzeigen, obwohl noch sehr viel Platz frei ist Android & Cross-Platform Mobile Apps 1
Dimax Android WebVieClient sendet keine Formulare Android & Cross-Platform Mobile Apps 1
J OnRatingBarChangeListener gibt keine Reaktion Android & Cross-Platform Mobile Apps 3
S Android kriege einfach keine HTTP Connection hin Android & Cross-Platform Mobile Apps 1
P Android JUnit Testprojekt warum keine Java Klassen Android & Cross-Platform Mobile Apps 1
S Android Eclipse erstellt keine main Activity Android & Cross-Platform Mobile Apps 4
K Android SQLite Query "WHERE _id in (X, Y, Z)" keine Daten Android & Cross-Platform Mobile Apps 6
P Android EditText zeigt keine Umlaute Android & Cross-Platform Mobile Apps 6
G keine TextView-Aktualisierung in der while-Schleife Android & Cross-Platform Mobile Apps 18
J ListView Item individuell einfärben Android & Cross-Platform Mobile Apps 17
I Android ListView, Werte aktualisieren ohne die Liste komplett neu zu laden Android & Cross-Platform Mobile Apps 5
W ListView OnItemClicklistener setzen mit Ausgabe Android & Cross-Platform Mobile Apps 35
K Null-Pointer-Exception in ListView - wird über Datenbank gefüllt Android & Cross-Platform Mobile Apps 1
I Android ListView (Custom) soll auf Hardwaretasten nicht reagieren. Android & Cross-Platform Mobile Apps 10
W ListView und Arrays... Android & Cross-Platform Mobile Apps 68
L ListView aktuallisiert sich nicht Android & Cross-Platform Mobile Apps 15
N Probleme mit custom dynamic ListView Android & Cross-Platform Mobile Apps 15
L Android ListView kollabiert in Scrollview Android & Cross-Platform Mobile Apps 9
A ImageButton in ListView Item bei klick ändern Android & Cross-Platform Mobile Apps 3
J Android Suche in einer ListView Android & Cross-Platform Mobile Apps 3
H Android ArrayList <-> ArrayAdapter <-> ListView Android & Cross-Platform Mobile Apps 10
L Android ListView swipe zum löschen Android & Cross-Platform Mobile Apps 1
B Android ListView set custom check Image and delete Android & Cross-Platform Mobile Apps 0
M Android ListView wird nicht dargestellt Android & Cross-Platform Mobile Apps 2
Maresuke Android Android ListView Textfarbe und Texthintergrund ändern? Android & Cross-Platform Mobile Apps 5
A Android Problem mit ListView und OnItemClickListener.. Android & Cross-Platform Mobile Apps 10
S Listview Einträge aus "xml" Datei Android & Cross-Platform Mobile Apps 1
S Android Studio MySql Daten in Listview mit sub Item Android & Cross-Platform Mobile Apps 11
S Textdatei in ListView einlesen Tutorial gesucht!? Android & Cross-Platform Mobile Apps 3
kaoZ Tutorial .xml Layouting für z.B ListView elemente Android & Cross-Platform Mobile Apps 7
M Android ListView und Checkbox Android & Cross-Platform Mobile Apps 6
L TableRows in ListView darstellen Android & Cross-Platform Mobile Apps 2
M ListView mit ListAdapter füllen Android & Cross-Platform Mobile Apps 5
U Android ListView Frage Android & Cross-Platform Mobile Apps 6
L Android SearchBox für Custom Listview Android & Cross-Platform Mobile Apps 5
H Android ListView Images aus dem Internet via Thread Android & Cross-Platform Mobile Apps 3
T Android: ListView-Adapter: Adapter wird ständig aufgerufen Android & Cross-Platform Mobile Apps 2
H Android SAX|ListView NullPointerException Android & Cross-Platform Mobile Apps 2
A Probleme mit ListView / ArrayAdapter Android & Cross-Platform Mobile Apps 3

Ähnliche Java Themen

Neue Themen


Oben