“This is the second day of my participation in the Gwen Challenge in November. See details: The Last Gwen Challenge in 2021”

👉 About the author

As we all know, life is a long process of constantly overcoming difficulties and reflecting on progress. In this process, there will be a lot of questions and thoughts about life, so I decided to share my thoughts, experiences and stories to find resonance!!

Focus on Android/Unity and various game development tips, as well as various resource sharing (websites, tools, materials, source code, games, etc.)

Welcome to pay attention to the public account [Mr. Empty name] for more resources and communication!

👉 premise

TextView: TextView, TextView, TextView, TextView, TextView, TextView, TextView, TextView, TextView

This is the Android series written by Xiao Kong, welcome to taste.

👉 Practice

Hello, everyone, welcome back. After our first acquaintance with Button last time, we have had our first impression of him. If we want to have deeper communication with her, we need to know more about her attributes.

Today we’ll just talk about properties, because Button inherits from TextView, so it has everything that TextView has, but not everything that TextView has.

  • Gravity: Internal alignment: left align, right align, center align, top align, bottom align these.
  • ** Android :inputType: sets the data type of the text. If the text contains any other type, it will not be displayed.
  • Android :text: Specifies the text to be displayed. This parameter is mandatory.
  • Android :textSize: set the textSize. This parameter is mandatory.
  • Android :textColor: Set the color of the text.
  • Android :textStyle: sets the textStyle.
  • Android :drawableBottom: Button an image appears at the bottom of the Button.
  • Android :drawableEnd: Button drawableEnd: Button
  • Android: Button drawableRight: Button
  • Android :drawableLeft: Button
  • Android :drawableStart: Button
  • Android :drawableTop: Button
  • Android :shadowColor: Set all text shadow colors, shadowColor, shadowDx, shadowDy, shadowRadius at the same time to achieve stereo text effect, taste excellent.
  • Android :shadowDx: Set all text x axis is horizontal offset, right is positive, left is negative, shadowColor, shadowDx, shadowDy, shadowRadius use at the same time to achieve stereo text effect, taste excellent.
  • Android :shadowDy: Set all text y axis is vertical offset, the bottom is positive, the top is negative, shadowColor, shadowDx, shadowDy, shadowRadius use at the same time to achieve three-dimensional text effect, excellent taste.
  • Android :shadowRadius: set all text shadowRadius, shadowColor, shadowDx, shadowDy, shadowRadius use at the same time to achieve stereo text effect, taste excellent.
  • Android: Clickable: sets whether the button is clickable. Note that when you write false in your layout and click events in your Java file, this will be reset to true, so you need to write it on the last line of your logic to make it clickable. Of course, there’s a nice property android: Enabled that can also be unclickable, which you can’t interact with until you actively set it to True.
  • Android :rotationX: supports rotation, y and z in addition to x.
  • Android :translationX: Also supports the shift attribute.

By the way, this Button inherits from TextView, and there’s an Imagebutton that inherits from Imageview, Imagebutton doesn’t have a text property, it’s mostly displayed by images, and if you convince the UI to try to make it as direct as possible with buttons and text, This will save you some of the work (note that this applies to things that are difficult to change and implement).

In addition to the above, Button also supports an important property, shape, which is used by almost all commercial buttons. This is a lot of stuff, so we’ll do it next time.

👉 other

📢 author: Kom and Kom in Kom

📢 reprint instructions – be sure to specify the source: Zhim Granular’s personal home page – column – Nuggets (juejin. Cn)

📢 welcome to like 👍 collect 🌟 message 📝