Ich folgte dieser Anleitung Android TabLayout Example using ViewPager and Fragments Android TabLayout Exampledie Ansicht Pager Fragment Swiping nicht die Registerkarten bewegen
Aber wenn ich das Fragment der Ansicht Pager wird sich nicht bewegen streichen. Ich bekomme dieses Ergebnis output I got Ich folgte dem oben genannten Tutorial nur keine Änderungen, aber wenn wir das Fragment wischen, werden sich die Tabs nicht verschieben. Bitte hilf mir. Danke im Voraus.
Dies ist der activity_main.xml
<LinearLayout
android:id="@+id/main_layout"
android:orientation="vertical"
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"
tools:context=".MainActivity">
<!-- our toolbar -->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
<!-- our tablayout to display tabs -->
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
<!-- View pager to swipe views -->
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
Code anzeigen. Außerdem gibt es in Android Studio eine Standardvorlage. Wenn Sie eine Aktivität erstellen, wählen Sie Aktivität mit Registerkarten + ViewPager und Sie erhalten einen funktionierenden Code, den Sie untersuchen und daraus lernen können. – Vucko
Ich folgte oben Tutorial perfekt funktioniert, außer diesem Problem. Wenn ich wische, werden die Tabs nicht wechseln, warum? –
Ich weiß nicht, ohne Ihren Code. Niemand tut. Bitte teilen Sie den relevanten Code mit (insbesondere Xml, wo Sie TabLayout deklariert haben). – Vucko