Well, I've developed a HorizontalScrollView with some buttons inside.
I'm able to get the width of this HorizontalScrollView through getWidth(). But that returns the width of the displayed HorizontalScrollView, not the full extension.
How could I get the full width? I mean, the full width including the buttons that are not displayed on the screen?
Cheers.
Your HorizontalScrollView should have only 1 child (a horizontal LinearLayout or something). Try getting the width of that view.
Related
I'm looking to create a table with 3 cells (TableRow) each cell should have the dimensions of the size of the full screen (width and height).
Should I use something other than a TableLayout to get the same effect?
Thanks a lot.
Here is an example of the expected result
The standard way of doing this will be by using a RecyclerView along with a Vertical Layout Manager, each and every one of your element will have width and height as match parent.
I am trying to add 3-4 imageviews in a scroll view. Imageviews have dynamic heights. Height of first view have 70% of the screen and second and third have 30% height. I am using constraint layout and guidelines but the height is getting set according to the height of the scroll view but not according to the screen height. Is there a way to do this with constraint layout.
Have you tried doing it programmatically?
First, get the Screenheight for your device: How to determine the screen width in terms of dp or dip at runtime in Android?
Secondly, get your Imagview and set its height according to xx% of the determined screen height.
BR
Please look at following 2 layouts.
First, cardview:
http://pastebin.com/iYzUiDQ7
Second, LinearLayout only (layout is actually the same as the one inside my CardView):
http://pastebin.com/xijHZCPw
So, second layout contains WebView component + single LinearLayout under it that should represent the same layout as single CardView item.
It works, however... I'm having problems with scaling images. If I set very large image as image for my ImageView placed on CardView, it will be scaled nicely to fit on my CardView. CardView's height won't be changed, instead, image will be scaled proportionally to fit.
But when I'm trying to do the same with second layout I linked, my LinearLayout changes its height if I set large image. How should I change my second layout to get the same effect for my LinearLayout, placed at bottom of my screen?
I get the difference between the two layout.
you had set the layout_height with 100dp in CardView. so the height of LinearLayout in CardView will does not beyond that. But you set the layout_height with wrap_content in you second LinearLayout.
Try to set maxHeight or layout_height with digit to deal with you problem.
Hope this can help you.
Hi I am working on GridView which has header and footer.
In my case, the header's width should fill the screen width like below
But I am getting the header filled the grid items' width.
I have used the library.
What should I have to do to make the header's width match with screen width.
Note : The header only should filled the screen width not the grid items. And the grid items should have right and left margins.
Use the HFGridview
`https://github.com/SergeyBurish/HFGridView/tree/master/HFGridView
By this you will acheve waht you want with little bit customisation. I already implemented that. If you face any problem let me know I will share code with you.
I have 4 views in the same activity. I want to move each Imageview on touch in whole screen, but it allow me to move in its width height.
Each image view's layout height and width is wrap_content.
It works fine with one image view with fill_parent.
Its explained in this example.