1-) Android RMOS - ProgressBar ile layout içinde loading yapmak
kaynak : https://harun.xyz/android/swipe-refresh-layout-nedir-nasil-kullanilir-android-studio/
SWİPELAYOUTU EN DIŞARI KOY
| <RelativeLayout 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"> |
|
|
| <androidx.swiperefreshlayout.widget.SwipeRefreshLayout |
| android:id="@+id/swipeRefresh" |
| android:layout_width="match_parent" |
| android:layout_height="match_parent" > |
|
|
| <LinearLayout |
| android:layout_width="match_parent" |
| android:layout_height="wrap_content" |
| android:gravity="center"> |
|
|
| <TextView |
| android:id="@+id/sayiBelirle" |
| android:layout_width="wrap_content" |
| android:layout_height="wrap_content" |
| android:text="Sayıyı Belirlemek İçin Yukarıdan Aşağıya Kaydırın." |
| android:textColor="@color/colorPrimaryDark" |
| android:textSize="30sp" |
| android:textStyle="bold" |
| android:textAlignment="center" |
| android:gravity="center" /> |
|
|
| </LinearLayout> |
|
|
| </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> |
|
|
| </RelativeLayout> |
DİĞER AŞAĞIDA
<ProgressBar
android:id="@+id/progressBarDoluMasa"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="100dp"
android:layout_marginRight="100dp"
/>
ProgressBar progressBar;
void showProgressView() {
progressBar.setVisibility(View.VISIBLE);
}
void hideProgressView() {
progressBar.setVisibility(View.GONE);
}
progressBar = alertLayout.findViewById(R.id.progressBar);
showProgressView();
hideProgressView();
DİĞER TASARIM ÖRNEĞİ
<LinearLayout
android:id="@+id/linearRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:orientation="vertical"
android:gravity="center"
android:weightSum="100">
<ProgressBar
android:id="@+id/progressBarFragmentUrun"
style="?android:attr/progressBarStyle"
android:layout_width="150dp"
android:layout_height="0dp"
android:layout_weight="100"
android:background="@android:color/transparent"
android:visibility="gone" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="100"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/RecylerView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>