Styles and Themes. Tell me about this XML snippet <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5"

Slides:



Advertisements
Similar presentations
Basic Principles for Web Design Source:
Advertisements

Table, List, Blocks, Inline Style
Intro To Cascading Style Sheets By Mario Yannakakis.
Cascading Style Sheets
Cascading Style Sheets (CSS) “Styles” for short. Pg. 418.
Cascading Style Sheets
Today CSS HTML A project.
HTML Overview - Cascading Style Sheets (CSS). Before We Begin Make a copy of one of your HTML file you have previously created Make a copy of one of your.
Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.
“Cascading Style Sheets” for styling WWW information DSC340 Mike Pangburn.
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
CSS normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
4.01 Cascading Style Sheets
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
Tutorial 3: Adding and Formatting Text. 2 Objectives Session 3.1 Type text into a page Copy text from a document and paste it into a page Check for spelling.
CSS (Cascading Style Sheets): How the web is styled Create Rules that specify how the content of an HTML Element should appear. CSS controls how your web.
Custom Views, Drawing, Styles, Themes, ViewProperties, Animations, oh my!
Cascading Style Sheet. What is CSS? CSS stands for Cascading Style Sheets. CSS are a series of instruction that specify how markup elements should appear.
XP New Perspectives on XML Tutorial 4 1 XML Schema Tutorial – Carey ISBN Working with Namespaces and Schemas.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
XP Tutorial 7New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks.
Dreamweaver -- CSS. Dreamweaver -- MX New icons are added in MX Most of the features commonly used in web design, and are same as FrontPage. New feature.
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
Week 4.  Three ways to apply CSS: Inline CSS Internal style sheets ( header style information) External style sheets.
INTRODUCTION TO HTML5 CSS Styles. Understanding Style Sheets  HTML5 enables you to define many different types of content on a web page, including headings,
Learning HTML. HTML Attributes HTML elements can have attributes Attributes provide additional information about an element Class – specifies a class.
Drawables and Skinning Widgets MOBILE SOFTWARE DEVELOPMENT.
INTRODUCTION TO HTML5 Styling Text. Change the Font Size  You can use the font-size property to change the font size for a document’s text.  Instead.
Intro to Dreamweaver Web Design Section 7-1 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
CSS CSS is short for C ascading S tyle S heets. It is a new web page layout method that has been added to HTML to give web developers more control over.
WRT235: Writing in Electronic Environments Basic CSS.
Introduction to Cascading Style-sheets (CSS) Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan 1.
Css. Definition Cascading style sheet (CSS)  It is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
Application Development for mobile Devices
1 Tutorial 12 Working with Namespaces Combining XML Vocabularies in a Compound Document.
INTRODUCTION TO CSS. TOPICS TO BE DISCUSSED……….  Introduction Introduction  Features of CSS Features of CSS  Creating Style Sheet Creating Style Sheet.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 8: Working with Style Sheets.
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
Microsoft Expression Web 3 – Illustrated Unit D: Structuring and Styling Text.
Slide 1 Graphics (Characteristics 1) Images have various characteristics that affect performance Size (number of pixels) – Large images can be several.
Cascading Style Sheets (CSS) EXPLORING COMPUTER SCIENCE – LESSON 3-5.
BUILDING A SIMPLE USER INTERFACE. In this lesson, you create a layout in XML that includes a text field and a button. In the next lesson, your app responds.
Group 9: Through examples, explain how to build a css navigation bar. Presented by: Daniel Ku, Matt Iannacci & Iphia Henry.
More App Customizations. Overview  Application/ Activity Customizations: Themes  Menu Customizations  Custom Dialogs  Custom Toasts  Custom Buttons.
HTML Tutorial. What is HTML HTML is a markup language for describing web documents (web pages) HTML documents are described by HTML tags Each HTML tag.
HTML5 and CSS3 Illustrated Unit F: Inserting and Working with Images.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
What is CSS? A set of style rules that tell the web browser how to present a web page or document. – In earlier versions of HTML, style characteristics,
1 Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size, font color etc…
CSS Introductions. Objectives To take control of the appearance of a Web site by creating style sheets. To use a style sheet to give all the pages of.
Working with Cascading Style Sheets
Cascading Style Sheets (CSS)
4.01 Cascading Style Sheets
Web Development & Design Foundations with HTML5 8th Edition
Cascading Style Sheets
Intro to Dreamweaver Web Design Section 8-1
Styles with Cascading Style Sheets (CSS)
Mobile Application Development BSCS-7 Lecture # 13
Web Development & Design Foundations with HTML5
HNDIT2417 Mobile Application Development
Android Layout Basics Topics
Graphics (Characteristics 1)
Cascading Style Sheets™ (CSS)
Android: Shapes.
Lesson 3: Cascading Style Sheets (CSS) and Graphical Elements
4.01 Cascading Style Sheets
Android: Shapes.
New Perspectives on XML
Presentation transcript:

Styles and Themes

Tell me about this XML snippet <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5" android:paddingLeft="5dp" android:background="#AAFF0000" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5" android:paddingLeft="5dp" android:background="#AAFF0000" />

Notice any problems? <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5" android:paddingLeft="5dp" android:background="#AAFF0000" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5" android:paddingLeft="5dp" android:background="#AAFF0000" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5" android:paddingLeft="5dp" android:background="#AAFF0000" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5" android:paddingLeft="5dp" android:background="#AAFF0000" />

What if I want to change the bg color? <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5" android:paddingLeft="5dp" android:background="#AAFF0000" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5" android:paddingLeft="5dp" android:background="#AAFF0000" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5" android:paddingLeft="5dp" android:background="#AAFF0000" /> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".5" android:paddingLeft="5dp" android:background="#AAFF0000" />

Who knows CSS? CSS allows the separation of design from content. Promotes reusability Easier to maintain

Does Android support CSS? No However, android provides a similar philosophy with styles and themes.

Android Styles A style is a collection of properties that specify look and format for a View. Styles can specify width, height, font color, font size, background color, etc. Styles are defined in a separate XML resource to separate layout from style.

What a difference style can make <TextView /> <TextView />

O Style Where Art Thou Place your styles in a new xml file in your res/values directory Typically the file is called styles.xml

Defining Styles 0dp wrap_content.5 5dp

1. Add a element 0dp wrap_content.5 5dp 1 For each style you want to create, add a element with a name attribute that uniquely identifies the style. The name attribute is required.

2. Specify style properties 0dp wrap_content.5 5dp 2 Define each style property using a element.

2A. Specify property name 0dp wrap_content.5 5dp The name attribute specifies which property of the view you want to style. Any XML property supported by the View/ViewGroup is supported. 2 2A

2B. Specify property value 0dp wrap_content.5 5dp The value for the specifies what value the property should have. The value for the item can be a keyword string, hex color, reference to another resource type, or other value depending on the style property. 2 2B

Accessing the Style The style can be referenced in XML layout resources by specifying a style attribute with a value equal to the desired style name.

3. Inheriting Platform Styles 0dp wrap_content.5 5dp 3 Use the parent attribute to inherit from styles defined by the Android Platform. The parent attribute is optional. Unfortunately, Platform styles aren’t well documented so you’ll have to dig around in source code to really understand what they look like. See here for details.here

4. Inheriting from your own styles #FF Prefix the new style name with the style name you would like to inherit from separated by a period. This example inherits everything defined in the loginTheme and simply adds a text color property of red.

4. Inheriting from your styles #FF0000 4A4A 1.4A is the style you’re inheriting. 2.4B is the name of the new style you are creating. 4B4B

4. Inheriting from your styles #FF0000 All attributes that are redefined in your style will overwrite any attributes of the same name that were defined in the parent style.

Inapplicable Styles If you define attributes in a style and then apply the style to a view that doesn’t have these attributes, the style will silently fail but you won’t see an error. It’s up to the developer to design and apply styles in a meaningful way

Style Documentation Android Style and Theme Documentation

Themes Themes are styles that are applied to an entire application or activity. If you know how to do styles then Themes are easy. See documentation here.here

Shape Drawables A declaratively defined and dynamically rendered graphical element Can used in any place where drawables are allowed, for instance for view backgrounds.

Types of Shapes Rectangles Ovals Line Ring

Shape Styles Fill Stroke Gradient

Shape Drawable Example

Shape Drawable Links Android Shape Drawable Documentation XML Drawables 3 Part Tutorial