Не могу смахнуть ящик - PullRequest
       64

Не могу смахнуть ящик

0 голосов
/ 27 марта 2020

Я новичок в разработке android, я создаю простое веб-приложение, и у меня есть это меню / ящик, который содержит 20 строк / записей, но я не могу провести пальцем вверх. В студии android я использую действия с ящиками, это единственные файлы, которые я использовал, я ничего не изменил.

MainActivity. java

package com.example.psalms;

import android.os.Bundle;
import android.view.View;
import android.view.Menu;

import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.navigation.NavigationView;

import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

public class MainActivity extends AppCompatActivity {

    private AppBarConfiguration mAppBarConfiguration;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        FloatingActionButton fab = findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
        DrawerLayout drawer = findViewById(R.id.drawer_layout);
        NavigationView navigationView = findViewById(R.id.nav_view);
        // Passing each menu ID as a set of Ids because each
        // menu should be considered as top level destinations.
        mAppBarConfiguration = new AppBarConfiguration.Builder(
                R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow)
                .setDrawerLayout(drawer)
                .build();
        NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
        NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
        NavigationUI.setupWithNavController(navigationView, navController);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onSupportNavigateUp() {
        NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
        return NavigationUI.navigateUp(navController, mAppBarConfiguration)
                || super.onSupportNavigateUp();
    }
}

Activity_main_drawer. xml

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:showIn="navigation_view">

    <group android:checkableBehavior="single">
        <item
            android:id="@+id/nav_home"
            android:icon="@drawable/ic_menu_camera"
            android:title="@string/menu_home" />
        <item
            android:id="@+id/nav_gallery"
            android:icon="@drawable/ic_menu_gallery"
            android:title="@string/menu_gallery" />
        <item
            android:id="@+id/nav_slideshow"
            android:icon="@drawable/ic_menu_slideshow"
            android:title="@string/menu_slideshow" />
        <item
            android:title="@string/home" />
        <item
            android:title="@string/ermninia" />
        <item
            android:title="@string/psalmos1" />
        <item
            android:title="@string/psalmos2" />
        <item
            android:title="@string/psalmos3" />
        <item
            android:title="@string/psalmos4" />
        <item
            android:title="@string/psalmos5" />
        <item
            android:title="@string/psalmos6" />
        <item
            android:title="@string/psalmos7" />
        <item
            android:title="@string/psalmos8" />
        <item
            android:title="@string/psalmos9" />
        <item
            android:title="@string/psalmos10" />
        <item
            android:title="@string/psalmos11" />
        <item
            android:title="@string/psalmos12" />
        <item
            android:title="@string/psalmos13" />
        <item
            android:title="@string/psalmos14" />
        <item
            android:title="@string/psalmos15" />
        <item
            android:title="@string/psalmos16" />
        <item
            android:title="@string/psalmos17" />
        <item
            android:title="@string/psalmos18" />
        <item
            android:title="@string/psalmos19" />
        <item
            android:title="@string/psalmos20" />
    </group>
</menu>

строк. xml

<resources>
    <string name="app_name">Psalms</string>
    <string name="navigation_drawer_open">Open navigation drawer</string>
    <string name="navigation_drawer_close">Close navigation drawer</string>
    <string name="nav_header_title">Android Studio</string>
    <string name="nav_header_subtitle">android.studio@android.com</string>
    <string name="nav_header_desc">Navigation header</string>
    <string name="action_settings">Settings</string>

    <string name="menu_home">Home</string>
    <string name="menu_gallery">Gallery</string>
    <string name="menu_slideshow">Slideshow</string>

    <string name="home_second">Home Second</string>

    <string name="home">Αρχική</string>
    <string name="ermninia">Ερμηνεία των Ψαλμών</string>
    <string name="psalmos1">Ψαλμός 1</string>
    <string name="psalmos2">Ψαλμός 2</string>
    <string name="psalmos3">Ψαλμός 3</string>
    <string name="psalmos4">Ψαλμός 4</string>
    <string name="psalmos5">Ψαλμός 5</string>
    <string name="psalmos6">Ψαλμός 6</string>
    <string name="psalmos7">Ψαλμός 7</string>
    <string name="psalmos8">Ψαλμός 8</string>
    <string name="psalmos9">Ψαλμός 9</string>
    <string name="psalmos10">Ψαλμός 10</string>
    <string name="psalmos11">Ψαλμός 11</string>
    <string name="psalmos12">Ψαλμός 12</string>
    <string name="psalmos13">Ψαλμός 13</string>
    <string name="psalmos14">Ψαλμός 14</string>
    <string name="psalmos15">Ψαλμός 15</string>
    <string name="psalmos16">Ψαλμός 16</string>
    <string name="psalmos17">Ψαλμός 17</string>
    <string name="psalmos18">Ψαλμός 18</string>
    <string name="psalmos19">Ψαλμός 19</string>
    <string name="psalmos20">Ψαλμός 20</string>
</resources>

Это Мой журнал событий

27/3/2020
5:32 μμ Gradle sync started

5:33 μμ Gradle sync finished in 47 s 503 ms

5:33 μμ Android Studio and Gradle are using different locations for the JDK.
                Android Studio: C:\Program Files\Android\Android Studio\jre
                Gradle: C:\Program Files\Java\jdk1.8.0_91
                Using different JDK locations might cause Gradle to spawn multiple daemons
                when executing tasks for Android Studio and other external processes.
                More info...
                Select a JDK from the File System
                Do not show this warning again

5:33 μμ * daemon not running; starting now at tcp:5037

5:33 μμ * daemon started successfully

5:41 μμ Executing tasks: [:app:assembleDebug] in project C:\Users\giorgis\Downloads\android\Psalms

5:42 μμ Gradle build finished in 34 s 905 ms

5:42 μμ Install successfully finished in 5 s 275 ms.

5:49 μμ Executing tasks: [:app:assembleDebug] in project C:\Users\giorgis\Downloads\android\Psalms

5:49 μμ Gradle build finished in 8 s 834 ms

5:49 μμ Install successfully finished in 5 s 96 ms.

6:46 μμ Executing tasks: [:app:assembleDebug] in project C:\Users\giorgis\Downloads\android\Psalms

6:46 μμ Gradle build finished in 9 s 206 ms

6:46 μμ Install successfully finished in 4 s 400 ms.

6:47 μμ Executing tasks: [:app:assembleDebug] in project C:\Users\giorgis\Downloads\android\Psalms

6:47 μμ Gradle build finished in 6 s 416 ms

6:47 μμ Install successfully finished in 3 s 944 ms.

6:50 μμ Gradle sync started

6:50 μμ Android Studio and Gradle are using different locations for the JDK.
                Android Studio: C:\Program Files\Android\Android Studio\jre
                Gradle: C:\Program Files\Java\jdk1.8.0_91
                Using different JDK locations might cause Gradle to spawn multiple daemons
                when executing tasks for Android Studio and other external processes.
                More info...
                Select a JDK from the File System
                Do not show this warning again

6:50 μμ Gradle sync finished in 8 s 638 ms

Ответы [ 2 ]

0 голосов
/ 27 марта 2020

После поиска я нашел эту ветку и мне удалось решить мою проблему вот ссылка { ссылка }

0 голосов
/ 27 марта 2020

Убедитесь, что вы используете новые зависимости

implementation 'androidx.navigation:navigation-fragment:2.2.1'
implementation 'androidx.navigation:navigation-ui:2.2.1'

Но вы должны создавать фрагменты для каждого добавленного нового элемента

...