Ich habe dieses Layout.Probleme in GridView Layout in Android
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.anandvardhan.albumview040416.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"/>
</android.support.design.widget.AppBarLayout>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/grid_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numColumns="2"
android:gravity="center"
android:background="#fff">
</GridView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_email"/>
</android.support.design.widget.CoordinatorLayout>
Aber jetzt bin ich eine Vorschau wie diese bekommen:
Wie ein Element an der Position 1 zu wählen, weil sie unterhalb der Symbolleiste sein muss.
Und noch etwas.
Wenn mein GridView anfänglich leer ist, muss es einen TextView in der Mitte des Bildschirms anzeigen, der besagt "es ist leer". Wie man es dynamisch einstellt.
Ich werde sehr dankbar sein, wenn jemand helfen könnte.
Geben Sie Ihren Code ein. – Aks4125
Versuchen Sie, 'GridView' Element an Position 1 in' XML' zu erreichen? – Aks4125
@ Aks4125: Standardmäßig sollte es nur von Punkt 1 beginnen. Aber in der Vorschau zeigt es von Artikel 3. –