In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
The knowledge of this article "Android how to use Shape to make a single frame" is not understood by most people, so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "Android how to use Shape to make a single frame" article.
The effect is simple:
Take the above figure as an example, only the top frame, the border is red, wide 1dp, and the rest is white.
Idea one
Two layers of canvas superimposed: red at the bottom and white at the top
Move the upper white canvas down to 1dp.
Code implementation:
The left, top, right and bottom attributes of the tag can be understood as the marginXX of view, so it makes sense to follow the second train of thought.
Idea two
Margin has both positive and negative values, so.
Two layers of canvas: the bottom layer is all white; the upper layer has only a red border, and the frame width 1dp
The upper red border sets the left, right and lower margin to-1dp respectively (here, as long as the negative value is greater than the width of the border, and must be greater than the width of the border)
Code implementation:
This is the case with the single border, and by the same token, the two and three borders are simple.
Pick it up on demand.
A pit?
You think it's over when you get to Zili? Pattern Tucson cannon!
Run the code of idea 2 above to see the effect.
What is the situation, the value of width in stroke and the value of left in item are not the same as the ratio of pixels? And the resolution effect of different mobile phones is also different, the higher the resolution, the easier to appear.
Of course, idea two sets the negative absolute value of left in item to be a little larger than that of width; in addition, there is no such problem in idea one.
The above is about the content of this article on "how Android uses Shape to make a single frame". I believe we all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.