ImageButton position - java

I'm trying to put an ImageButton on my app. This is a sort of hidden button, is the blue rectangle. Now, i want to put this button right and down, but as you can see, i can't, because there are two space to the right and down. (Where there are the two green arrow). How can I remove that space? Thanks!

Adjust the padding of the View that contains the button.
Layout XML:
android:padding

Related

What are these element called?

I'm developing my first real app and found inspiration in Instagrams design.
I would like to know what the red and blue area is called and if these exist within androids own libraries so I can implement them.
I guessing that the blue area is something called carousel list/tab-list or button menu or maybe a lot of radio buttons? If you, for example, press on the Juno filter, the list will automatically scroll towards left, so you can see the rest.
The red rectangle is horizontalscrollview and the blue rectangle is LinearLayout with three child.
there are multiple options but I think the blue box in LinearLayout and Red one might be a simple scrollview

How to slide in slide out a view from Top to it's original position

I have a view in my activity at some position from the top. Now i want to slide it out/in to/from the Top on a button click.
Initially it should be invisible.
1) When button click it should be visible but animating from top to it's position.
2) When button click it should be invisible from it's position to top.
Can anyone have code for implementing this idea. What kind of animation is needed to write.
Please share your experience. Thanks in advance.

Moving JButton text over its icon by pixels

I am creating a desktop application in Java with lots of customized UI.
It also has a breadcrumb.
I've extended JButton class to customize it for my Breadcrumb buttons.
This is the screenshot of expected breadcrumb.
http://puu.sh/4MtvZ.jpg
The background of this breadcrumb is an ImageIcon.
But now, I am not able to perfectly align the JButton text over this background icon.
This is the screenshot of actual breadcrumb.
http://puu.sh/4MtDc.png
I've used following code to align the text.
setHorizontalTextPosition(CENTER);
setVerticalTextPosition(CENTER);
So, is their a way that I can move this text in pixels to its right position?
And also, I want root breadcrumb button "Schemes" to overlap some part of its preceding breadcrumb button "2000 Avenues" as shown in expected breadcrumb screenshot!
How can I achieve that?
Check out the Overlap Layout for one solution.
So, is their a way that I can move this text in pixels to its right position?
I don't understand this question. Why are you setting the alignment to center if you want it aligned to the left.
Edit:
I see. You are just using an Icon for the button outline and are then painting the text on top of the Icon. I thought your were using a custom shaped button with text). You can just use the default vertical/horizontal text position settings.
To shift the text to the left you can use:
button.setIconTextGap(10 - button.getIcon().getIconWidth());

Alternative to dp for text view alignment with background

I have a text view on my android app which I want to place in a specific place on the screen. This is because there is a background on the screen and the text view has to show in line with the space I have made for it in the background.
I'm moving the text around using the margins and entering for example 20dp for top margin 10dp for right margin.
Is there any other method I can use in order to ensure that the text view will be displayed in the right place on all devices? As other dvices mas have a higher or lower res.
use relativelayout and you can control the position of a view in a much better way.
android:layoutalign_parentright=true tag makes the view to be the right always.
android:align_right="#id/someViewId" makes the right edge of this view aligned with the right edge of someViewId view.
It packs a lot of tags that enables you to do such stuff.

Creating launcher animations in android

I am thinking about making a launcher for android, i dont know if i'll market it. But i'm thinking like my phone is in landscape mode, and i see 4 rows of buttons, and 4 buttons on each row. Kind of like a grid with buttons. And then, once i click a button, i want the buttons splitted in the middle and moved from each other, with an animation. And then a second screen comes in from the back. How can i do this? I thought of creating two layouts holding 4 buttons each, and once i click one, it should move the layouts from each other and the second blank screen would kind of fly in from the back, like if it was behind the buttons. How can i create these animations? Please help me and thanks so much!
You can add a middle row with width initially as 0dp, and then when opening an Activity you could animate its width, and for the second screen you can use a simple zoomIn animation with overridePendingTransition() after startActivity()

Categories