First of all I hope you've had a great holiday and fun new years eve eventhough there is a pandemic.
I am developing an app as part of a project. But I seem to have some problems with the GridView.
When I inflate it with items it goes beyond the borders of the screen.
This is when scrolled the top. As you can see the top of the GridView is beyond the borders of the screen.
This is when scrolled to the bottom. As you can see the bottom of the GridView is also beyond the borders of the screen.
I think it might have something to due with a navigationbar fragment that I have in the bottom. In XML they are both defined as following:
<GridView
android:id="@+id/gridView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnWidth="100dp"
android:numColumns="1"
android:stretchMode="columnWidth"
app:layout_constraintBottom_toTopOf="@id/nav_bar_container"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:verticalSpacing="10dp"
/>
<LinearLayout
android:id="@+id/nav_bar_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
</LinearLayout>
And my inflater for the GridView works as following:
if (gridView == null) {
LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
gridView = inflater.inflate(R.layout.profile_friend_item, null);
}
Don't know if anyone has tried the problem, but hope that someone will be able to help.
Best regards
Sejr
PS: The generated profiles range from [0-9] and if you need any more details please hit me up. I will happily share them. :)
question from:
https://stackoverflow.com/questions/65617491/gridview-blowing-screen-borders-in-android-studio 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…