Change lock in the background!!

Интерфейс, диалоги, темы, стили, меню
Ответить
SorimBela
Сообщения: 3
Зарегистрирован: 15 июл 2021, 05:22

Change lock in the background!!

Сообщение SorimBela » 17 янв 2022, 13:30

t is often necessary to put an image on the button instead of the text.
There are at least two ways here:
1) use Button
2) use ImageButton
In the first case, everything is simple and clumsy, put the desired image in the background (if you need a 9-patch) and voila, everything works without glitches . The problem is that there will be no interactivity, ie clicks and focus. Writing manually is extra work
In the second case, when using ImageButton, you can create xml describing all three states of the button, and this will be processed automatically (read morehttp://developer.android.com/reference/ ... utton .html). The problem is that the "border" of the standard button image remains at the edges of the button, and your image is placed in the center. Like this:
Picture
There are many places where to get rid of this it is advised to put the background in the ImageButton, ie # 00000000, but a glitch appears: if the background is not black, then the background image that is placed BEYOND the button is duplicated and placed on the background of the button, adjusting to the size. And when layout in a visual window in the eclipse, everything is fine, but the device is not ice. Illustration:
Picture

The way out was found in the setting in the background ImageView of the image 1 * 1 pixel, transparent.
PS Perhaps there is a way to do without this, I will be glad if you voice i

Charles12
Сообщения: 2
Зарегистрирован: 21 янв 2022, 07:07

Re: Change lock in the background!!

Сообщение Charles12 » 26 янв 2022, 13:02

Thanks for the information. It really helped me!
geometry dash

Ответить