android: Viewpager geçişlerinde sayfa yüklenmemişse buton pasif etmek.

Rapor et
Soru

Bu soru rapor edilmelidir hissediyorum neden kısaca açıklayınız.

Rapor et
İptal

merhaba, burda yeniyim arkadaşlar şöyle bir sorunum var. Viewpager2 Butonlarım geçiş sırasında eğer görüntü yüklenmemişse pasif olmasını istiyorum. bunu bir türlü yapamadım. kodlar aşağıda yardımcı olursanız sevinirim.

fragment_cartoon.xml

<pre class="xml"><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="fill_parent"
android:layout_height="fill_parent"
tools:context=".Fragment.CartoonFragment">

<androidx.viewpager2.widget.ViewPager2
android:id="@+id/viewPager2_"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:ignore="MissingConstraints" />

<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/progressBar"
style="@style/Widget.AppCompat.ProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/coordinatorLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
tools:ignore="MissingConstraints">

<ImageButton
android:id="@+id/btn_down"
style="@style/Button.Small"
android:layout_width="@dimen/show_options_button_width"
android:layout_height="@dimen/show_options_button_height"
android:layout_marginStart="0dp"
android:layout_marginBottom="@dimen/show_options_button_margin_large"
android:contentDescription="@string/set_wallpaper"
android:gravity="center"
android:src="@drawable/ic_download"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btn_setter"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent" />

<Button
android:id="@+id/btn_setter"
style="@style/Button.Large"
android:layout_width="@dimen/show_options_button_width_large"
android:layout_height="@dimen/show_options_button_height_large"
android:layout_marginStart="20dp"
android:layout_marginBottom="@dimen/show_options_button_margin_large"
android:contentDescription="@string/set_wallpaper"
android:text="@string/set"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/btn_fav"
app:layout_constraintStart_toEndOf="@+id/btn_down" />

<ImageButton
android:id="@+id/btn_fav"
style="@style/Button.Small"
android:layout_width="@dimen/show_options_button_width"
android:layout_height="@dimen/show_options_button_height"
android:layout_marginStart="20dp"
android:layout_marginBottom="@dimen/show_options_button_margin_large"
android:contentDescription="@string/set_wallpaper"
android:gravity="center"
android:src="@drawable/ic_dislike"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/btn_setter" />

</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

</pre>

 

item_viewpager.xml
<pre class="xml">

<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:id="@+id/gallery_root"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<LinearLayout
        android:id="@+id/layut"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:orientation="vertical"
        android:weightSum="30">

<FrameLayout
android:id="@+id/wallpaper_preview_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:ignore="UselessParent">

<ImageView
android:id="@+id/movie_image"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<androidx.core.widget.ContentLoadingProgressBar 
android:id="@+id/progressBar"
                style="@style/Widget.AppCompat.ProgressBar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                app:layout_constraintTop_toTopOf="parent" />
</FrameLayout>
</LinearLayout>
</RelativeLayout>
</pre>

 

<pre>
/**
 * A simple {@link Fragment} subclass.
 */
public class CartoonFragment extends Fragment implements IFirebaseLoadDone, ValueEventListener {
    private ViewPager2 viewPager2;
    private ViewPagerAdapter viewPagerAdapter;
    List<Movie> movieList = new ArrayList<>();
    private ImageButton btn_down, btn_fav;
    private Button btn_setter;
    private int STORAGE_PERMISSION_CODE = 1;
    private OutputStream outputStream;
    private DatabaseReference movies;
    private IFirebaseLoadDone iFirebaseLoadDone;
    private ContentLoadingProgressBar progressBar;
    ProgressDialog pd;

public CartoonFragment() {
        // Required empty public constructor
    }
@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_cartoon, container, false);

movies = FirebaseDatabase.getInstance().getReference("Sports");
        movies.keepSynced(true);
        iFirebaseLoadDone = this;
        loadMovie();

 

</pre>
Devam Ediyor 1
Android 3 ay 1 Cevap 104 görüntüleme Intern 3

Yazar HakkındaIntern

Cevap ( 1 )

  1. Avatar

    Bu cevap rapor edilmelidir hissediyorum neden kısaca açıklayınız.

    Rapor et
    İptal

    kimse cevap vermiyor mu? cevabı bilen biri olmalı, eminim

Cevap bırak

Gözat

KOD PAYLAŞIRKEN DİKKAT!!!!

HTML kod paylaşmak için

<pre class="html">HTML KOD</pre>
XML kod paylaşmak için
<pre class="xml">XML KOD</pre>
Diğer dillerde(php,java,android,javasvript,c# vs..) kod paylaşmak için
<pre>KOD</pre>
tagları arasında paylaşmayı unutmayın.