All Questions

Filter by
Sorted by
Tagged with
36 votes
6 answers
42k views

Heterogeneous GridLayout

I am trying to implement the layout below: I guess GridLayout is suitable for my needs but after 2 hours of struggle I couldn't create even a similar layout.. The layout is resizing itself wrongly, ...
C.d.'s user avatar
  • 9,956
27 votes
4 answers
8k views

GridLayout spitting out "inconsistent constraint" debug-level logs

I've been using GridLayout for a few weeks now and I've noticed that when I call gridLayout.requestLayout() it spits out the following debug-level message in LogCat: D/android.widget.GridLayout(...
mdupls's user avatar
  • 2,012
16 votes
2 answers
28k views

Android: How to create a GridLayout [not GridView] programmatically?

I am developing a "match the following" application. The xml used for the application is as follows: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/...
Srikanth's user avatar
  • 306
14 votes
2 answers
12k views

How to make Android GridLayout compatible to older version?

New GridLayout for Android 4 is good. Both in terms of code maintainability and performance. I wanted help with backward compatibility for GridLayout for older version. Waiting for official ...
Siddharth Menon's user avatar
10 votes
1 answer
8k views

GridLayout from support library does not show 2 rows on Android 2, onChildVisibilityChanged Error

Has anybody gotten the support library to render a grid layout correctly in Android 2? Instead of 2 rows and columns I get a single row on the screen and see this error in the logcat output: Android ...
Beth Mezias's user avatar
9 votes
4 answers
25k views

Eclipse giving an error of android.support.v7.widget.GridLayout failed to instantiate

I have tried to incorporate the GridLayout from the support library, but it is not working. My target build is for API version 10. The XML code I am using is shown below: <?xml version="1.0" ...
Aviral's user avatar
  • 1,141
7 votes
2 answers
466 views

Alignment not right when adding view dynamically to GridLayout

When added buttons by XML - All good <GridLayout android:id="@+id/social_gl_content" android:layout_width="match_parent" android:layout_height="match_parent" android:...
Vipul J's user avatar
  • 6,671
6 votes
1 answer
3k views

SetGravity for GridLayout not working

I am using a simple GridLayout to which I'm adding buttons dynamically. <GridLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tagGridLayout" android:...
RaWa's user avatar
  • 123
5 votes
2 answers
3k views

What is difference between GridView, GridLayout and Recycler view with GridLayout?

I am developing an app in which i need a layout like provided images. Which layout should i use? and why ? What is difference between GridView and GridLayout ? why they are in legacy section ? What ...
Faisal Imran's user avatar
4 votes
2 answers
10k views

Get BottomSheetBehaviour from BottomSheetDialog

This is my layout for BottomSheetDialog. I've a grid layout inside as well. That grid layout's scrolling is not proper. I mean it scrolls only in expanded state of BottomSheetDialog. <LinearLayout ...
div's user avatar
  • 1,493
4 votes
2 answers
3k views

Creating a grid like layout in Android

Basically, I have a view that needs to be split up into a 2x4 grid, with each section equal in size (i.e. each row would be 25% of the screen height, and each column would be 50% of the screen width). ...
user avatar
4 votes
1 answer
2k views

android.support.v7.widget.GridLayoutManager$LayoutParams cannot be cast to android.widget.LinearLayout$LayoutParams

activitymain.xml <android.support.v7.widget.RecyclerView android:background="@color/primary_text" android:layout_marginStart="@dimen/...
Ankur Khandelwal's user avatar
4 votes
2 answers
2k views

gridlayout's children visibility gone

This is my .xml. When I touch the cell - visibility sets as View.GONE, but it just disappearing as View.INVISIBLE. There is an empty space in the place when cell was. The size of cells is fixed. How ...
ant's user avatar
  • 407
3 votes
1 answer
3k views

Name of GridLayout in Android Studio 3.1 or how can I use it in 3.1?

What is the name of GridLayout in Android Studio 3.1 or how can I use it in 3.1?
Meylis Toylyyev's user avatar
3 votes
2 answers
5k views

GridLayout giving errors, crashing app

I'm pretty new to layouts, but I was able to successfully make a pretty nice looking layout (for a tablet). In Eclipse, it works great. I made it all with the 'target' on Android 4.0 (ICS), but ...
ajwest's user avatar
  • 258
3 votes
1 answer
1k views

Android GridLayout cutting off

I'm following this tutorial: http://code.tutsplus.com/tutorials/android-user-interface-design-creating-a-numeric-keypad-with-gridlayout--mobile-8677 But in my application, I'm getting the result: I ...
Felipe M's user avatar
  • 449
3 votes
0 answers
210 views

Space arround ripple effect in GridLayout

I am currently trying to create a layout which looks like the default Google Calculator in the latest Android. Now I am struggling with the GridLayout and a custom component (called FlatButton). The ....
zimmerrol's user avatar
  • 4,921
3 votes
1 answer
2k views

Android GridLayout.Spec

I am working on an app and use the GridLayout.Spec to set row and column span programmatically. But there is a problem: If i start the app on an AVD with API 16 everything works fine. If i start it on ...
Andreas Hohn's user avatar
2 votes
5 answers
9k views

GridLayout not working

I created a GridLayout and CardView, but card view not working I am using Android Studio 3.0.1 When I look in the Design View, everything looks right. But when I look up the run, I do not see the ...
Sunil Kumar's user avatar
2 votes
1 answer
131 views

Button inside Grid layout is null

I am creating custom grid. Each row has 1 button and 2 textviews. I am trying to assign values/text to each programmatically. I am able to set text for both the text views but, findviewbyId for button ...
user1181942's user avatar
  • 1,587
2 votes
2 answers
3k views

android.support.v7.widget.GridLayout can not instantiate

been struggling with this for a couple hours, not sure why I can't get the damn thing to compile. When I try to include the android.support.v7.widget.GridLayout, I see the following error in my ...
Karim Varela's user avatar
  • 7,592
2 votes
1 answer
538 views

GridLayout not showing as I expect

Sorry, I'm not doing well with layouts. I'm trying to add a button, next to another button, next to some text fields. When I say the button is in column 3, on the preview it leaps of the screen to ...
AndyCr15's user avatar
  • 465
2 votes
1 answer
644 views

Android custom GridLayout - ImageView into multiple cells

I am trying to build such a view: Supposing that lines represents GridLayout and I need to build views 1x1 2x2 3x3 4x4 and 5x5. Views can begin not only from first cell. I can't handle this behavior, ...
Vasile Doe's user avatar
  • 1,714
2 votes
1 answer
405 views

TextViews clipped in Dynamic GridLayout (Android)

I'm using a GridLayout (from the support library, if that matters) into which I dynamically add TextViews. I here get a problem with all TexViews getting added in only one row, which also leads to ...
moviaa's user avatar
  • 402
1 vote
2 answers
934 views

How to create android app home screen with 4 icons? [closed]

I have 4 icons. I want to create 4 rectangles with icons on it. Also I want to add text below icons. Which components should I use? How to implement it? I trie GridLayout and TableLayout but I don't ...
Gaurav Vichare's user avatar
1 vote
2 answers
82 views

Which android control should i use to get 2 by 2 scrollable grid in android?

How can i have 2 by 2 scrollable Grid? Which control should i use? I tried Grid-View and as Grid-View can not have fixed rows so should i use Table-Layout or Grid-Layout ? or use linear-Layout in ...
Muhammad Irfan's user avatar
1 vote
1 answer
649 views

Fit ImageViews into Android GridLayout

I need to place 4 images into GridLayout. If I define their sizes hard-coded. e.g. android:layout_width="150dp" android:layout_height="200dp" It works fine. But my question is, if ...
Ilya's user avatar
  • 33
1 vote
1 answer
446 views

Grid Layout Not Showing In Real phone Android

I am making Card View Inside GridLayout. I Run My Application On My Real Device. My CardView Not Showing I also Check Like this Question In StackOverflow But That Question May Vary From My Code This ...
Security Coding's user avatar
1 vote
2 answers
49 views

How can I make a GridLayout universal for all devices?

I'm working on an XML activity with 12 buttons in a GridLayout (3x4), and I want these buttons to be equally distributed (if that's the right term) on the screen for all devices. Here is the XML ...
Wild_MJ's user avatar
  • 37
1 vote
1 answer
67 views

My gridlayout is not inflating as expected

<LinearLayout 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:...
intA's user avatar
  • 2,611
1 vote
2 answers
275 views

android gridlayout row and column not match the result

I want to create a GridLayout Here is my setting from server: items.add(listOf(4, 3, 0, 0)) -> start at x: 0 - y:0 expand horizontal : 4, vertical 3 items.add(listOf(1, 1, 0, 3)) -> start at x:...
famfamfam's user avatar
  • 496
1 vote
1 answer
823 views

How to dynamically add cardview to grid layout

I am trying to add cardview to GridLayout dynamically. But it is not adding the cardview. The Hierarchy is ScrollView --> HorizontalScrollView --> LinearLayout --> GridLayout and I want to add to ...
gorak devender's user avatar
1 vote
1 answer
95 views

Trouble with scroll in view (GridLayot + GridView)

I have some problems with the scroll in the following view <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android....
DarkVss's user avatar
  • 75
1 vote
1 answer
436 views

Gridlayout preivew is right but on real device gets compressed

I am new to Gridlayout in android, but i create a layout which looks fine on preview screens but when i run it on real device all items gets compressed and get aligned to top-left of screen This ...
Reprator's user avatar
  • 2,939
0 votes
2 answers
107 views

Added ScrollView In Constaint Layout With GridLayout Its Not Working

I am trying to make a dashboard that looks like this on this link, but with one column I want to make the dashboard to be scrollable. I want to add a ScrollView on the below code.I have tried every ...
lemmy njaria's user avatar
0 votes
1 answer
70 views

GridLayout columns do not appear right

I tried to configure a grid layout with 2 rows and 2 columns. But each element here occupies the entire width of the screen, while the second column is outside the screen. Please suggest what am I ...
jay's user avatar
  • 2,012
0 votes
2 answers
237 views

How to align Gridlayout children linear layouts in center on orientation change?

How to align Grid layout's children linear layouts in the center on orientation change? I am having an app with a constraint layout having a grid layout further having linear layout children (circles ...
Hoshang S's user avatar
0 votes
1 answer
2k views

How to make cardview responsive?

]2]2 this is NamazActivity.java In java class i just add cardview click listener and open a toast message. Every click listener shows the iteam ID with simple text package com.example.shakeelmughal....
Shakeel Mughal's user avatar
0 votes
1 answer
962 views

Setting button size programatically in grid

Sorry for my title, might not be very explicit. Before I start, just want to let you know I'm really new at Android programming. So, what I'm trying to create is a sudoku board. It doesn't have to ...
Zorobay's user avatar
  • 609
0 votes
1 answer
773 views

How to build my own Grid Layout in ANDROID so that it can work with the devices which are below API 14

I want to build a Calculator App, in which I want to format all the required buttons in such a way that, they all appears in a Grid form to me.... The one which I've made is only running on Android 4....
Saumya Rastogi's user avatar
0 votes
1 answer
35 views

<GridLayout Redlined in Android Studio-How to fix

I'm new here so I'm not sure about the depth of this question being appropriate, but I've been working on this Project for weeks and I've got an error I don't know how to fix. The layout is a Grid. ...
user23431134's user avatar
0 votes
1 answer
46 views

Why does GridLayout doesn't work on my real android device?

enter image description here When I run on virtual device it works fine: enter image description here This is my gradle file dependencies { implementation("androidx.appcompat:appcompat:1.6.1"...
Gold Potato's user avatar
0 votes
0 answers
21 views

Add space before GirdLayout which is inside ScrollView

I want to add some space before the GridLayout starts and I want to fit a button and textview there. I tried adding Space before GridLayout, but it didn't do anything. I could make a button and ...
GeoCap's user avatar
  • 515
0 votes
1 answer
51 views

GridLayout images go off screen

In the design and blueprint view it looks that it fits, but on app some images go off screen. I want to have all images shown, without scrolling. It doesn't need to support landscape orientation, only ...
GeoCap's user avatar
  • 515
0 votes
3 answers
1k views

How to re-position the grid layout elements in fragments on orientation change?

I am having a bottom tabbed activity with three fragments Home, Dashboard and Notifications. In the first fragment, I am having 4 layouts with a button in each layout. These 4 layouts are aligned ina ...
Hoshang S's user avatar
0 votes
1 answer
31 views

GridLayout of Buttons auto aligns left, ignoring Grid lines

I have a very straightforward grid of buttons to make a keyboard. In this, I want "A" to be halfway in the middle of "Q" and "Z", so instead of 10 columns, which is what I require, I have 20 columns ...
Dev Bali's user avatar
0 votes
1 answer
333 views

Custom Grid Layout column border

I have a question. How can I do that custom double side border in my xml file? I tried to use various variants of custom drawable, but in the end it did not work out the result I needed. Any ideas? ...
Дмитрий Самойлов's user avatar
0 votes
2 answers
934 views

GridLayout overflows the screen

I have images in a Grid Layout. However the Grid Layout rows overflow the screen. I think the image widths are not the cause of problem. If I delete the images, the grid layout lines still overflow. ...
Orhan Avan's user avatar
0 votes
2 answers
1k views

Gridlayout of buttons greater than 4 columns

I'm trying to make a GridLayout of 8x8 buttons (like a minesweeper). I'm managing the weights to all have the same width but it works fine until 4 buttons. When I add the 5th button in column 4 they ...
juanjovn's user avatar
  • 492
0 votes
1 answer
66 views

Gridlayout changes widths

I've been trying to get a gridlayout to work using: <GridLayout android:layout_width="match_parent" android:layout_height="70dp"> <TextView android:text=...
Diesel's user avatar
  • 519