android-gridlayout

Set Text on a GridView Image in Android

梦想的初衷 提交于 2019-11-28 11:20:38
问题 I have a grid view that have 8 images Now on a particular image view i want to set a text value that will be changed dynamically Main XML <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <LinearLayout android:id="@+id/mainLinearLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout

Android GridLayout API 21

半世苍凉 提交于 2019-11-28 00:44:29
问题 I'm trying to accomplish something like this: Currently, I'm manually setting the width of the tiles equal to half the screen width. This works well, but it makes adding dividers between the tiles (as seen in the screenshot) hard. Luckily, it seems that in API 21, there is now support for weight in GridLayout, quoted here for your convenience: As of API 21, GridLayout's distribution of excess space accomodates the principle of weight. In the event that no weights are specified, the previous

Set layout_column and layout_row in GridLayout programmatically

*爱你&永不变心* 提交于 2019-11-27 23:37:49
I have a GridLayout (not GridView) where I want to add some views with a special row and column inex. In XML I can set the View with: <TextView android:id="@+id/textView1" android:layout_column="2" android:layout_row="4" android:text="Large Text" /> But how can I set the attributes layout_column and layout_row programmatically? I want something like this: GridLayout grid = new GridLayout(getActivity()); grid.setColumn(2); grid.setRow(4); grid.addView(new Button(getActivity()); The equivalent of layout_column and layout_row , as with all layout_... parameters, is to be found as a parameter of a

android.support.v7.widget.GridLayout cannot get it to work

混江龙づ霸主 提交于 2019-11-27 17:17:00
问题 I have an android project which utilizes GridLayout in most of its menus and screens. The problem however is that GridLayout is supported from API 14 and onwards. Since I want to make the application available to older version of android as well, I tried to use Android's own Support Library GridLayout which adds support up to API 7. This was exactly what I was looking for, however I cannot for the life of me get it to work. I have tried all of these explanations and ideas: Android's official

GridLayout(not GridView) - Spaces between the cells

天涯浪子 提交于 2019-11-27 15:32:18
I am using GridLayout (support) for displaying ImageView s in my application. There are 3 columns and 5 rows. The problem is that the cells in the GridLayout automatically get some space between them. I am not setting any padding or margin for the cells. Please refer to the image below. All cells are added dynamically and here is how I add these cells. Getting Screen Width and Height: Point size = new Point(); getWindowManager().getDefaultDisplay().getSize(size); screenWidth = size.x; screenHeight = size.y; rowHeight = (int) (screenHeight * 0.2); Adding View to GridLayout: GridLayout

GridLayoutManager - how to auto fit columns?

夙愿已清 提交于 2019-11-27 10:56:11
I have a RecyclerView with a GridLayoutManager that displays Card Views. I want the cards to rearrange according to the screen size (the Google Play app does this kind of thing with its app cards). Here is an example: Here is how my app looks at the moment: As you can see the cards just stretch and don't fit the empty space that is made from the orientation change. So how can I do this? Code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Json; using System.Threading; using System.Threading.Tasks; using Android.Media; using Android.App; using

Android - Difference between Gridlayout and Staggered Gridlayout

隐身守侯 提交于 2019-11-27 10:17:38
问题 I am working in android material design api & want to display some data in grid format. I tried both GridLayout and StaggeredGridlayout and both look same. For general information, i want to ask what is the difference between Gridlayout and StaggeredGridlayout ? Thank you. 回答1: Grid View : It is is a ViewGroup that displays items in a two-dimensional, scrollable grid. In this each Grid is of same size (Height and width). Grid View shows symmetric items in view. Staggered Grid View : It is

Android - Gridlayout android.support.v7.widget.GridLayout cannot be cast to android.widget.GridLayout

 ̄綄美尐妖づ 提交于 2019-11-27 09:23:25
I want to create a GridLayout able to run in all the APIs. The thing is, when i use GridLayout instead of android.support.v7.widget.GridLayout the app runs fine in Android 7.1.1 but in older versions it crashes. But if i use android.support.v7.widget.GridLayout instead of GridLayout (like the code below) it always crashes. activity_main <?xml version="1.0" encoding="utf-8"?> <ScrollView 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

How to support `layout_columnWeight` and `layout_rowWeight` in pre API 21?

五迷三道 提交于 2019-11-27 07:35:49
问题 I use the below grid layout with layout_columnWeight and layout_rowWeight to centralize my view in the grid cell. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" > <GridLayout android:id="@+id/container_grid" android:layout_width="match_parent" android:layout_height="match

gridView with different cells sizes, pinterest style

假装没事ソ 提交于 2019-11-27 03:20:45
Background GridView is a class that extends AdapterView , which means it shows cells in a grid-style efficiently, recycling old views to be shown as new ones when the user scrolls it. The problem Sometimes, you would want to get a special UI, which resembles the Windows Phone Tiles UI, having cells of different sizes on top of each other. Something like this: AABB AACC AADD AADD each letter represents a part of its cell, so cell A is 2x4 , cell B and cell C take 2x1 each , and cell D is 2x2 . It could be even more than that, where cell D finished a bit above what i've shown, and right beneath