In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to use color resources in android development", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to use color resources in android development" bar!
Define an Android project named "Chapter03_Resource". In the project's resvalues directory, define a colors.xml color resource file, as shown below.
# f00
# 0000ff
Define a layout resource file under the reslayout directory of the project, add a TextView view component to the file, reference the color resource, and set the text color of the view component TextView to blue.
Define a TestColorActivity class, reference the color resource file, and set the background color to red.
Package com.amaker.ch03.color
Import android.app.Activity
Import android.os.Bundle
Import com.amaker.test.R
Public class TestColorActivity extends Activity {
@ Override
Public void onCreate (Bundle savedInstanceState) {
Super.onCreate (savedInstanceState)
SetContentView (R.layout.test_color)
/ / reference the color resource and set the background color to red
GetWindow () setBackgroundDrawableResource (R.color.red_bg)
}
}
Thank you for your reading, the above is the content of "how to use color resources in android development". After the study of this article, I believe you have a deeper understanding of how to use color resources in android development. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.