Showing posts with label introduction. Show all posts
Showing posts with label introduction. Show all posts

Saturday, January 31, 2015

Android beginner tutorial Part 10 TextView introduction

Today well start learning about text widgets in Android.

A widget is any UI component in Android - a button, a text field, a slider, etc. You have a set of pre-built widgets to create your application with.

Today we will start learning about text widgets. There are two classes responsible for displaying text: TextView and EditText. The TextView class simply displays text on screen, without giving the user the ability to edit the text. If you want the text to be editable, use EditText.

Both of these classes inherit many properties and methods from the View class, and it should also be noted that EditText is a subclass of TextView.

In this tutorial well start learning about the first class I mentioned - TextView.

Its a simple but at the same time one of the most used widgets in Android applications. It is also used in other widgets for displaying text data, and quite a few widgets are actually extensions of this class. So, anything with text in it is related to TextView class one way or another.

You should keep that in mind, because TextView class has a few unique attributes and methods that are also available in any classes that extend TextView.

Properties for this class can be defined in XML layout file, or programmatically in a Java class.

For example, if you want to apply a text value to a TextView object, you can use that using the android:text XML attribute, or using the setText() method in Java. Usually the attribute and method names are similar (android:textColor and setTextColor();), but not always (android:textColorHighlight and setHighlightColor();).

Ive already wrote about ids in Android, they can be defined using the android:id attribute and generally look like this:

android:id = "@+id/myObject"

And to refer to this object later, the plus symbol is emitted:

"@id/myObject"

The text values can be defined using an id, which refer to separate objects in res/values/strings.xml file.

For example, if you set the text value of a TextView like this:

android:text = "@string/myText"

It would refer to this part in the strings.xml file and use that value:

<string name="myText">Hello world!</string>

To set the value similarly in Java:

TextView text = (TextView)findViewById(R.id.myObject);
text.setText(R.string.myText);

The Java syntax might look strange to you if youve never dealt with it before. Here is what the same code would look like in AS3 syntax (note: not working code):

var text:TextView = (myObject as TextView);
text.setText(myText);

The strings.xml should be used most of the time to declare text values, instead of hardcoding the values directly into the attribute. This is done mainly because of the ability to add new languages.

Thats all for today. Well continue next time.

Thanks for reading!
Read more »

Thursday, January 29, 2015

Introduction to Layer Masks in Photoshop

Layer masking is a very useful feature in Photoshop that allows you to hide some areas (make them invisible) of a layer. A layer mask can be altered using the brush tool. To hide areas using a layer mask, you must paint the mask using black. To make areas fully visible, you use white. Using gray will make areas translucent (not quite visible, but not quite invisible as well).

Ive posted three different videos about layer masks here. Theyre all introductory videos about layer masks, but there are some things in one video that you might not learn from the others, so Ive decided to add them all here.

This first one is by Nathan Ridley from Graphics District. He uses Photoshop 7 in this tutorial, but you can still follow along even if youre using CS2 or CS3.

Introduction To Layer Masks In Photoshop 7 from Nathan Ridley on Vimeo.

This next one is from IceFlowStudios on YouTube. The speaker also talks a little bit about vector shapes in the end. But its ok if youre not familiar with what vector shapes are and what you can do with them. The main point of these videos is for you to learn how to use layer masks and you dont really need knowledge in vector shapes in order to achieve that. The speaker simply wanted to show an example that uses a layer mask on a vector shape. The Photoshop version used in this video is CS3.


This last one is from TutorialStop.com. The Photoshop version used in this video is CS3.

If you want to use the images in this video, here are the links:
Waterfall
Highway
Be sure to read the Creative Commons license applied to both images.
Read more »