How to set Gridlines to a GridView in Android - android

I am using GridView to show a summary report of 3 columns in my app. EveryThing seems to work fine except the GridLines for Gridview is missing.
Can anyone please suggest how to display GridLines for GridView and even Headers.
Thanks.

I actually have a much simpler solution.
What you can do is that set the vertical and horizontal spacing for your Gridview to, say 1dp or 2dp depending on how thick you want the border to be. Then just set the background color of your GridView to the color you need for your borders.
Let me know if this works for you.

Related

Android Force GridView items to fill full gridview height

First of all I'd like to say it isn't any duplicate. My problem is tha I have to much items and I want to make them smaller to fill in gridview height. That's why I cannot use setMinimumHeight. I need something like setMaximumHeight but nothing like this is predicted by Android SDK. Additionally I don't have any row spacing so I cannot make it smaller.
image to help understand:
I want make itemw smaller height, I don't want any to be "cut" by the display border.

put large number of equally sized ImageViews in a row

Within a layout I want to put 11 equally sized (more or less quadratic) ImageViews in a row. Only one of them shall be displayed at a point in time. It is crucial that the ImageView number x starts EXACTLY at x/11 of the screen width. This might sound trivial, but after some attempts and research I'm not so sure anymore.
What I tried so far is using a horizontal Linear Layout, putting 11 ImageViews in it and applying
android:layout_width="0dp"
android:layout_weight="0.0909"
to each of them and set visibility to VISIBLE for one of them and to INVISIBLE for all others in the code. Unfortunately this solution is not really reliable and I see that the position of the ImageViews vary slightly.
Another attempt, using the displayed ImageView as thumb of a seekbar and setting the seekbar's progress to number x was also not great on all devices I tested.
What is the best practice here to get stable results? Thanks in advance.

Android layout development

I would like to develop a layout below. I am really confuse related to that. I used RelativeLayout, FrameLayout to develop this. But I am not getting perfect output. As per below image, the Dark Gray color is overlap the light Gray layout. If I used Relative layout then dark Gray will be in the light Gray area. And if I used FrameLayout then the other controls of light Gray will not set perfectly.
Please guide me the right path. I am stuck in this layout. Thanks in advance.
According to your figure, If all widgets need to show without scrolling vertically , you can have vertical linear-layout here,
TextView
Button,
ImageView
List view with defined height
Other widgets

Gridview and gridlines of android application

I am using GridView in android application also displaying data from sqlite database to GridView, now my problem is, data has been displayed but I am not able to show grid lines in GridView, so how can I do it?
Set the vertical and horizontal spacing for your Gridview to, say 1dp or 2dp depending on how thick you want the border to be. Then just set the background color of your GridView to the color you need for your borders.

How to set border of Gridview

I am developing an Android app. And i am trying to show a DashBoard. DashBoard is working fine. I have taken gridview to display it, But I want to set the border of that gridview. How can i achieve it ? if anyone can suggest me something useful.
You can override GridView drawing and draw border from there.
You can add rectangular shape as the background.
You can put your GridView inside another layout, set background color for that layout and set margin for the GridView. (not really good as Android has to draw big single-color view and then cover it with GridView)
Lots of ideas here: How do I put a border around an Android textview?

Categories

Resources