LIBGDX/Android - How can scale a view? - android

I am trying to get a bar at the bottom of the screen where ads can be placed and have found no way of doing so. What I am trying to do is pretty much this (below)
You can see that there is a gap for adverts to fit in at the bottom, meaning that the view of the game doesn't actually take up the entire screen.
How can I achieve this? I am looking for maybe a way to scale the view to change its height but I don't know how

You put both in a relative layout. Make the bar aligned to the parent bottom, then make the game view align to the top of the bar.

Related

How to make view slide onto screen?

I want to make a horizontal LinearLayout that has a portion off screen slide onto the screen when it is dragged, using horizontalLayout.setX(), but when the layout is dragged the views in that layout that were off the screen don't seem to appear on screen, and they seem to be cut off by the screen edge. What would be the best way to achieve this? Can a view not be created off the screen?
I don't know whether I understood properly but..why don't you just use a horizontal scroll view?

how to make material style set up page

As you can see in the picture from the link below, i want to make a same set up screen in this material design style. I have searched the web but can't even find the name of this kind of screen.
Can anyone give me a name of it? or show me some library that provide this kind of screen. thanks in advance!!
http://3.bp.blogspot.com/-7_w8_KbH7a0/VLcpuwPexsI/AAAAAAAACx4/9zORceLZ5NA/s1600/Screenshot_2014-12-16-03-04-06.png
This is actually something that you can implement yourself. In the top, you could place any ImageView. In the center, there goes a RecyclerView to display a list of wifi networks. And at the bottom, there are 2 buttons (nothing's special about this one).
So, perhaps you could structure your layout like the following
LinearLayout (Vertical Orientation)
|_ImageView
|_RecyclerView (0dp height, with layout weight 1)
|_LinearLayout (Horizontal Orientation)
|_Button
|_Button

How to put the right border of a View onto horizontal center?

In my Android app, I am using a RelativeLayout to custom one of my Activitys.
I have a square ImageView that I want to set precisely. In other words, I want its right border to touch the horizontal center of the layout.
Is such a thing possible without doing weird things such as centering and then marging?
It's not a perfect solution but potentially you could use:
android:layout_marginRight="xdp"
Where x is half of your screen width + half the width of your imageView?
I know it's not perfect but might help until some guru comes along

Android: Drag View outside screen

I have an activity where users can drag and drop around some buttons.
All my draggable views are inside a RelativeLayout and to drag them around I change their top and left margins.
Everything works perfect, except that when I drag the views close to the right and bottom edge of the screen, they shrink instead of being drawn outside the screen.
Is there any way for having the same behaviour on the all edges of the screen (currently only works fine on the top and left edge).
I guess I can have a left and top negative margin. But when I have left margin > screen width or top margin > screen height the images shrink.
To implement custom positioning of views inside a ViewGroup the best way is to implement your custom ViewGroup overriding onLayout().
It is not that difficult and I explained how to do it here. (the question is newer and has more visibility)
Edit:
You might also want to look into the Drag and Drop Api here. Thanks to Zainodis for the comment.

overlay imageview without pushing layouts down

a picture is worth a thousand words, so my question should basically be self-explanatory with the attached image: How to get rightmost screen instead of the center screen?
turns out i cannot attach images directly yet, so i have to link to it right now:
How to get rightmost screen instead of the center screen?
just to add, i realise that it is not really possible to have the framelayout NOT expand as shown in screen 2b, but my question remains as to how to achieve such an overlay without pushing the Other layouts down i.e. the bottom part of the imageview would be on top of the top right part of the other layouts
perhaps you could have the image you are dynamically adding be outside the frame layout. ie have a relative layout contain both framelayouts and the imageview – jkhouw1 1 hour ago

Categories

Resources