Android Layouts 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS 1.

Slides:



Advertisements
Similar presentations
2D Graphics Drawing Things. Graphics In your GUI, you might want to draw graphics E.g. draw lines, circles, shapes, draw strings etc The Graphics class.
Advertisements

Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
Chapter 2. Paint Pot We will build the Paint Pot app in class. Notes regarding the screen/user interface: 1.7 buttons and a canvas 2.The canvas has a picture.
Basic 2D Graphics in Android. Android Graphics Programming There are many ways to do graphics programming in Android – 2D vs. 3D – static vs. dynamic.
© red ©
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
Lab 5: drawing and output User Interface Lab: GUI Lab Sep. 25 th, 2013.
6-2 2D Graphics CSNB544 Mobile Application Development Thanks to Utexas Austin.
Color Theory.
Graphics Concepts CS 2302, Fall /17/20142 Color Concepts.
Doodlz App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
CSE 219 Computer Science III Images. HW1 Has been posted on Blackboard Making a Game of Life with limited options.
Colors By Jes Betzold Red YellowBlue Orange PurpleGreen.
Java Graphics. Review 3 kinds of elements in components API? Layout managers Events Extend vs. Implement.
Hello, I am Vincent. I am a painter. I like to draw.
Android Graphics Library. Color Android colors are represented with four numbers, one each for alpha, red, green, and blue (ARGB). Each component can.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Introduction to Android (Part.
By: D. Kritikos. Draw picture here Color selection.
Announcements Homework #2 will be posted after class due Thursday Feb 7, 1:30pm you may work with one other person No office hours tonight (sorry!) I will.
Splatter! ALPHA Presentation By: David Kikuta March 29, 2011.
Elements of Art Review. What is Value? Value  The lightness or darkness of a color.
Android Threads. Threads Android will show an “ANR” error if a View does not return from handling an event within 5 seconds Or, if some code running in.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
Colour Theory Colour Wheel Colour Values Colour Schemes.
Graphics in Android 1 CS7030: Mobile App Development.
Basic 2D Graphics in Android. Android Graphics Programming There are many ways to do graphics programming in Android – 2D vs. 3D – static vs. dynamic.
By: Eliav Menachi.  Android custom 2D graphics library  OpenGL ES 1.0 for high performance 3D graphics.
The Doodlz app enables you to paint by dragging one or more fingers across the screen. The app provides options for setting the drawing color.
Whittier STEM Fair 2016 CARLI PECORARO’S ANDROID APP PROJECT.
Color Theory.
Android Application 2D Graphics cs.
Lecture 8: Graphics By: Eliav Menachi.
Learning our elements of art!
week # 03 Visual Programming Variables Canvas Screen Arrangement
#5 Grade 1 ~ Sight Words Pictures series in film strip effect
Mobile Computing With Android ACST 4550 Android Logs and Gestures
#3 Grade 1 ~ Sight Words Pictures series in film strip effect
What are we learning? Why are we learning it? How to mix colors
Color Theory.
Basic Graphics Drawing Shapes 1.
Color Theory.
#6 Grade 1 ~ Sight Words Pictures series in film strip effect
Building Java Programs
Represent Re-present Pictures series in film strip effect
Name: _______________________________
Color Theory.
#1 Grade 1 ~ Sight Words Pictures series in film strip effect
Average Number of Photons
#4 Grade 1 ~ Sight Words Pictures series in film strip effect
UNIT3 Colour.
Color Theory.
By Andrea Mira and Frank Chen
Color Theory.
Color Wheel Color Values Color Schemes The color wheel fits together like a puzzle - each color in a specific place. Being familiar with the color.
What Color is it?.
©
Using Plickers for Just-in-Time Feedback
C c Cc is for cat. © ©
©
Color Theory Study Guide
Color Theory.
Lecture 8: Graphics By: Eliav Menachi.
Color Theory.
Web4Labels 3.1 Colour and logo definition features
Color Theory.
Color Box Button - Gray Type : object Type : object Type : object
Color Theory.
Let’s Learn the Basic Colors
CIS 470 Mobile App Development
Color Theory.
Presentation transcript:

Android Layouts 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS 1

Android Drawing App Implement Drawing The core features of this app will include: Draw – Users will be able to draw on a blank canvas (whiteboard) . Erase – Users will be able to erase what has been drawn. Undo – Users will be able to undo and redo drawing paths. Color – Users will be able to draw using a color of their choice from at least these colors: black, dark gray, light gray, blue, red, and green, orange, yellow . Share – Users will be able to capture a screen shot and email it to a friend. Implement Drawing To draw something on the screen, you have to respond to or override one of such events – the onDraw() event which is where every view draws itself. The Three components that you must understand to effectively create an Android drawing app. Canvas Paint Path Canvas – as the name implies, the Canvas is what you draw upon Paint – after you obtain the surface to draw upon – the Canvas, you also need something to draw with – the Pain Path  – now that you have the surface to draw upon and the drawing object to use to draw upon that, you need to decide what direction that you want to draw. Do you want to go up, down, left or right. 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS

Make a basic single touch drawing app for Android 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS

The basics about using the onTouch event Creating a custom view The basics about using the onTouch event The first thing we want to do now is create a custom View. We can do this by creating a new class that extends the View class. 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS

In the designer view of your main activity 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS

Using the onTouch event to draw on a canvas Now that we have our view created we can implement the code to draw on a Canvas. We need to: Set a paint style Listen for a touch event Create a new starting point when we touch the screen Draw a path when we move our finger Redraw the view when the onTouchEvent fires. First, let’s declare some variables and override the onDraw and onTouchEvent functions. We want the onTouchEvent to fire the onDraw method to update the view with the new information. For this we can just call invalidate() from onTouchEvent. 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS

We need the onDraw event to draw the path on the canvas. 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS

Of course now we still need to make sure our paint variable gets a color, style and width. We will define this upon construction the view. Edit your constructor like this: We now have defined that our path will be stroked with a black color  that is 5dpi in width. The points of the path we draw will be joined and rounded. Now all that is left is to make sure that we add points to the path when we move our finger over the screen! Edit the onTouchEvent like this: 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS

Thank You 24 July 2018 S.RENUKADEVI/AP/SCD/ANDROID LAYOUTS