logo
down
shadow

Recyclerview move to and visibility going off-screen


Recyclerview move to and visibility going off-screen

Content Index :

Recyclerview move to and visibility going off-screen
Tag : android , By : user182203
Date : November 29 2020, 12:01 PM

Does that help When I set something visible in my recycler view "visibility = VISIBLE" it goes offscreen if its close to bottom or top, I wanted to know if is there any way to make the recyclerview focus in it when VISIBLE is called. , Use include to place you view in the app bar layout
<com.google.android.material.appbar.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true"
    android:layout_weight="1"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        app:title="Gerenciador de Prioridades"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        app:layout_scrollFlags="scroll|enterAlways">
    </androidx.appcompat.widget.Toolbar>

<include layout="@layout/content_main" />

</com.google.android.material.appbar.AppBarLayout>

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

How set visibility widget in recyclerView


Tag : android , By : user137798
Date : March 29 2020, 07:55 AM
I wish this help you Just add holder.nextImageButton.setVisibility(View.VISIBLE); into else statement
WHY?:

Drag-n-Move - How to avoid RecyclerView background fill the entire screen even there's only a few items in RecyclerView


Tag : android , By : Kaputnik
Date : March 29 2020, 07:55 AM
should help you out If the RecyclerView is longer than the area allocated to it on the screen then there is no issue: Just set the background color of the RecyclerView to red. However, if the items in the RecyclerView do not fill up the space allocated to the RecyclerView in the layout then you will see the red background in the empty space. This is what you want to eliminate.
To do this, set a OnGlobalLayoutListener on the RecyclerView and check if there is excess space or not. If there is not excess space, then just set the background color to red; otherwise, create a BitmapDrawable filled with red and properly sized to provide a background to just the items on the screen and not large enough to spill into the excess area.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final RecyclerView recyclerView = new RecyclerView(container.getContext());
    recyclerView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            recyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
            if (recyclerView.getChildCount() == 0) {
                return;
            }

            int lastChildBottom = recyclerView.getChildAt(recyclerView.getChildCount() - 1).getBottom();
            if (lastChildBottom >= recyclerView.getHeight()) {
                recyclerView.setBackgroundColor(Color.RED);
                return;
            }
            Bitmap bitmap = Bitmap.createBitmap(recyclerView.getWidth(), lastChildBottom, Bitmap.Config.ARGB_8888);
            bitmap.eraseColor(Color.RED);
            BitmapDrawable d = new BitmapDrawable(getResources(), bitmap);
            d.setGravity(Gravity.TOP);
            recyclerView.setBackground(d);
            recyclerView.invalidate();
        }
    });
    return recyclerView;
}
public class RecyclerViewBackground extends Drawable {
    private RecyclerView mRecyclerView;
    private Bitmap mBitmap;
    private Paint mPaint;

    RecyclerViewBackground() {
        super();
        mPaint = new Paint();
        mPaint.setColor(Color.RED);
    }

    @Override
    public void draw(Canvas canvas) {
        if (mRecyclerView.getChildCount() == 0) {
            return;
        }

        int bottom = mRecyclerView.getChildAt(mRecyclerView.getChildCount() - 1).getBottom();
        if (bottom >= mRecyclerView.getHeight()) {
            bottom = mRecyclerView.getHeight();
        }
        canvas.drawRect(0, 0, canvas.getWidth(), bottom, mPaint);
    }

    @Override
    public void setAlpha(int alpha) {
    }

    @Override
    public void setColorFilter(ColorFilter colorFilter) {
    }

    @Override
    public int getOpacity() {
        return PixelFormat.OPAQUE;
    }

    public void attachRecyclerView(RecyclerView recyclerView) {
        mRecyclerView = recyclerView;
    }
}
RecyclerViewBackground bg = new RecyclerViewBackground();
bg.attachRecyclerView(recyclerView);
recyclerView.setBackground(bg);

Recyclerview's visibility is Visibility. Invisible, still It shows a white backgound on the screen


Tag : android , By : eataix
Date : March 29 2020, 07:55 AM
Does that help As you can read at INVISIBLE tag description

Recyclerview preview showing grey screen with android.support.v7.widget.RecyclerView in center


Tag : android , By : user182548
Date : March 29 2020, 07:55 AM
hope this fix your issue I am trying to add Recyclerview to my activity layout but the layout preview shows me this. I went through all possible answers which i could find out and tried doing things like , Try this:
compileSdkVersion 27
buildToolsVersion '27.0.1'
targetSdkVersion 27

After refreshing data, the RecyclerView seems to move down on the screen


Tag : android , By : Adam Hill
Date : March 29 2020, 07:55 AM
Does that help OK, it looks like I had set the recyclerview layout_constraintBottom_toBottomOf was set to 'parent' and since the total height of the recyclerview shrunk when the number of items shrunk, it was moving the view to the bottom of the screen. I also could get rid of the top margin attribute and the recycler view stayed below the buttons. So now I have:
    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/workPackagesRecyclerView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical"
        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/btnFilterBy"/>
Related Posts Related QUESTIONS :
  • How can I make AndroidX the default library for new Android projects?
  • Is it okay to delete buildToolsVersion android studio because of a warning in the Asyncstorage library?
  • Can I call a class that doesn't have an activity withIntent?
  • Android TextView fontFamily not working when set via TextAppearance
  • Unable to find nearby places
  • Is there any way to launch my application right away without 'Ok Google"?
  • Places api set location biased based on current location
  • Layout Preview is not displaying layout when Material Design is added
  • How do I resolve this diamond problem in Kotlin?
  • How to update the custom value in a view model object
  • How to stop refreshing/re-creating activity when updating Firebase data using setValue?
  • Manifest Permissions vs App Setttings Permissions
  • NumberFormatException in Try-Catch while converting String to Int
  • How to pass observable fields through include tag?
  • Next button on Android keyboard not submitting form
  • Does Firestore support automatic functions for updates?
  • Why app crashing because of a missing dimension (for google maps) only when I apply changes?
  • How to make a grouping, ordering and sorting: Kotlin collection
  • how to use augmented reality to change the color of a qr code once it is detected using with arcore and ml kit firebase
  • how to resolve Firebase projects adding quota problem?
  • Why it Kotlin giving me the wrong Int value when converting from a String
  • How to add bottom navigation listeners to fragments
  • Why is scrollview hiding buttons behind other views?
  • Open Settings using Linking.sendIntent()
  • How do I access an unknown node in firebase while retrieving data?
  • Can't retrieve list of all users from firebase authetication
  • many activities with same content (adview, reward adview, functions...) how to avoid repeating code?
  • Popup doesn't hide when touch outside
  • proper way to handling images in Android? by using Firebase
  • Android: Button is faded gray when it should be transparent
  • Gradle DSL method not found: 'deleteAllActions()'
  • In Clean Architecture, must Repository is Android or Kotlin module?
  • Kotlin parse double from string
  • Inconsistency detected. Invalid view holder adapter positionViewHolder
  • In App Update API always returns 1 (UPDATE_NOT_AVAILABLE)
  • Event of ImageView when click
  • Basic precautions to prevent piracy?
  • What is the difference between 'center' and 'centerCrop' in the "ImageView"?
  • Unable to receive SIP calls when app is killed
  • Android emulator not processing http get request, but iOS simulator works fine
  • Android Problem with sharing temporary file
  • How to add Broadcast in Android?
  • How to hide 'Running in Chrome' toast on TWA application on Android devices?
  • How to Fix Error: Could not find method deleteAllActions() for arguments [] on task
  • Android Deep Linking not working with https
  • WARNING: API 'variant.getMergeResources()' is obsolete and has been replaced with 'variant.getMergeResourcesProvider()'
  • setSupportActionBar (androidx.appcompat.widget.Toolbar) in AppCompatActivity¬†cannot be applied
  • Manifest merger failed after adding Firebase core version 17.0.0
  • Marker from Firestore map data type
  • Cordova signed apk produces a blank screen after splash screen
  • How to clear EditText input from all item views of RecyclerView?
  • Android Studio Mac Fresh install - error after error after error
  • Android Q, programmatically connect to different WiFi AP for internet
  • Application is becoming very slow while retrieving data from server
  • How to get Accelerometer value in Android XAML App(Xamarin.Forms)
  • androidx.constraintlayout.widget.ConstraintLayout cannot be cast to android.widget.TextView
  • Synchronized singleton in Kotlin
  • Product details from barcode
  • What is the difference between armeabi-v7a, arm64-v8a, x86?
  • Where did the "Profile or Debug APK..." option disappear to in Android Studio 3.4.1?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com