Join Albert Lo for an in-depth discussion in this video Define styleable resource, part of Android Development: Modern Android UI Design Elements.
- [Instructor] Now we are ready to define our styleable resource. To do that, let's move the mouse over to CheckBox in red, and we move over to the lightbulb, and we select Create styleable value resource. We'll just add some default value here, that we'll change later on, and now let's press Command B. Now we're going to add two attributes. The first one will be attribute on.
And the format will be string. And I'm going to add the enclosing tag here, I'm going to make a copy of it and paste it here, we'll add another attribute for off and it's also format string. The two attributes that we define here for our checkbox will be the SVG resource filename for the checked state and the SVG resource filename for the unchecked state. Note that we could define other attributes here as well.
For example, I have defined the animation duration or the default text as a styleable attribute for other custom views that I have built in other apps. Now we're ready to go back to the checkbox class.
- Creating a custom layout with XML
- Setting up OnClick handlers
- Making API calls
- Creating custom views
- Implementing ViewHolder objects
- Signing certificates
- Adding a checkbox
Skill Level Intermediate
Building Android Apps with Cloud Serviceswith Albert Lo2h 37m Intermediate
1. Understanding the Side Navigation Drawer
2. Custom RecyclerView: Multiple View Types
3. Custom RecyclerView: ViewHolders
4. Understanding Custom Views
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.