android apps, learn android programming, android for beginners, android
This Page - How To Change Android View Background Color Prev Page - Adding Buttons To Android Activity View
Next Tutorial How To Add An Image to Activity View

We are using AIDE, to create these tutorial apps on our tablet with android version 4.2.2; using the Java XML programming language.
We are using AIDE, to create these tutorial apps on our 8.9" tablet with android version 4.2.2; using the Java XML programming language.

We are using the AIDE coding editor to code our pages; and then to Create - RUN our apps. AIDE is a SDK coding environment for android devices like a tablet or smartphone. AIDE has a free and paid version. The paid version is required if you want to create Java/xml template apps; and add a 'keystore' to your App. With a keystore, you can publish it to the market places like Google and Amazon.
Once you create your apps code pages, you need to RUN the app to build your apk package; then you INSTALL it on your tablet or smartphone.

You can also create; RUN your apps using the code in these tutorials, with Android Studio. Android Studio is for desktop computers. Choose Java XML as the programming language. Android Studio is free to install and use; and has helpful guides.

Complete Example Codes are available for each of our tutorials. With these example codes you can make a functioning android app in either AIDE or Android Studio.



If you are just arriving at this page; you can gohere to first create your simple app

If you just want to get the code for this tutorial goto:
Your Apps layout file and the manifest file, these 2 files must be edited for this tutorial

In our Example Codes on this page, simply copy the code you want into your app's layout file, typically - default name is main.xml(can be named whatever you like) and also the app config file - androidmanifest.xml (cannot be renamed) For this tutorial the layout file is main.xml located at: AppProjects/tutorials/res/layout/main.xml
You can also just use snippets of our code; example- maybe you just want the code for a button element.



If you are following along and coding with our tutorials - This is what Your TUTORIALS App should now look like:
Tutorial - Buttons


Once we edit our App with this TUTORIAL, the App will look like this;
Android Beginner Tutorial - Background Color, Screen Orientation

This is the first Activity(page) of our App; and all items(elements) are placed in the View; The View class has many Properties(code classes) and Elements(attributes) you can add to your App.

To create your own App click the link on this page to create Android App
Once you create your App you can follow along with each tutorial.
In this Tutorial: we are editing the App we created using AIDE; named Tutorials -

Changing the Appearance with Background Color,
Changing how the screen looks with Screen Orientation,
Adding additional Buttons with Text;

As with previous tutorials, we reference Android Developer website with code classes we are using, and also, you can view all the class properties, elements available for any given code class at the website:

For this tutorial:
....how to change View background Color - LinearLayout element, Android View class
....how to change Screen Orientation- ACTIVITY element, also known as an App component(because it is required)
....how to code Buttons - BUTTON element, View class

Our App Named: Tutorials

To make these changes we will be editing these files and elements:

the App LinearLayout element, which is in the layout file of your App - named main.xml
You can locate it at
AppProjects/tutorials/res/layout/main.xml

the Activity element, coded in the manifest.xml file, located at root of your AppProject,
AppProjects/tutorials/androidmanifest.xml

the BUTTONS element, also coded in layout file,(main.xml)

How To Code
to change background color: placed at LinearLayout element,
android, changing background color in the View
we use android:background="#ffffff", (white - you can name any color here )

to change the Screen Orientation, placed at Activity element,(androidmanifest.xml file)
android,changing screen orientation, activity component
we use android:screenOrientation= "portrait", (portait, more tall than wide, or landscape, more wide than tall )
When the app is opened by a user, the app will present itself, more tall. There are several variations you can also use with portrait, as explained in our Coding Tips section.

As you read in our previous tutorial, BUTTONS can be any size, can be placed anywhere within the View, and can have text or even an image added to them. The text can be placed in different areas on the button, as shown in our tablet screen view image. For this tutorial we added additional buttons and added text properties to place the text in different areas of the buttons.




Coding Tips

Change Background Color For the View

In addition to changing a background to any color you can also add a background image for the background. You can read about this at the Developer Website from the links on this page.


Change Screen Orientation

Changing Screen Orientation is done in the Activity element of the androidmanifest.xml file with the common screen orientation attributes being Portrait and Landscape, including variations of each.

There is also another orientation that is commonly used, that being:

Android:orientation,

however, it applies to the screen layout for design purposes, and is coded in the Linear Layout element. The attributes are Vertical and Horizontal. This is coded in the LINEARLAYOUT element.
android, changing background color in the View

If your App is going to be used moreso on your phone than a tablet; or you plan to distribute your App at the market places, and phone users is the demographic you are seeking; then Portrait orientation be a better screen view type to use, as cell phone usage at this time is far greater than tablet users.


Adding Buttons and editing them

Text can be added to Buttons, and you can also add text to a button with an image. The actual text you want shown in the Button is added to the strings.xml file, as shown in this image of the strings.xml file, and each line of text can have its own string name.

android, coding strings.xml
Text can be styled using several style properties available in the View class.
Text can also be underlined, bolded, or italized, simply by adding the appropriate code tags in the string itself;
u for underline, b for bold, i for italics. You place the tag around the word(s) you want tagged, as shown in this image.

Strings are placed in the strings.xml file, it is a resource file, located at:
res/values/strings.xml
Attributes and Properties for Buttons at Developer Android website.
Buttons

Having made our changes: We will now RUN our app to update the app files:
(To RUN your app, click the top right icon in AIDE, the choose RUN. Follow prompts to install, and update the app.)
Then, simply open the app to view it.



Here is the image view of all code changes made in this Tutorial for our App named - "Tutorials"




Background Color, Screen Orientation, Buttons






Code For This Tutorial

This is the code for all edits we have done to our app named Tutorials, for this - Background Color, Screen Orientation, Buttons tutorial; so you can just copy and paste to replace the code you now have in these files:

strings.xml
main.xml
androidmanifest.xml
App Name is Tutorials - located at AppProjects/tutorials in AIDE, open the AIDE app, then open App Projects,

once this code is placed in each page,
save each page, then RUN your code, INSTALL the app, to see the changes made.
























Code:
Use Mouse To Copy Paste the Code Code For This Tutorial

This is the code for all edits we have done to our app named Tutorials, for this - Background Color, Screen Orientation, Buttons tutorial; so you can just copy and paste to replace the code you now have in these files:

strings.xml
main.xml
androidmanifest.xml
App Name is Tutorials - located at AppProjects/tutorials in AIDE, open the AIDE app, then open App Projects,

once this code is placed in each page,
save each page, then RUN your code, INSTALL the app, to see the changes made.

This free script provided by
JavaScript Kit



AIDE for creating Android Apps on your tablet or cell phone(android).
Free and Paid - with Free create Java/xml template apps and couple free android lessons. With paid some lessons included, create Java/xml template apps; create a keystore for your app. With a keystore you can publish your app at markets like Google.
GoTo Aide

ANDROID STUDIO - for creating Android Apps on your desktop computer.
Free to Install and Use
GoTo Android Studio Learn more - Android Studio

The Java XML files we code(example codes) and the Android Apps we create in our Free Tutorials are compatible with Android Studio and AIDE. Just choose Java XML as your Programming Language.


You May Like:
Make Sushi Rolls at Home Taste World Wines Flavours and Aromas

TUTORIALS I
Java XML
The Coded Pages

Beginners Article
About Our Tutorials
Coding androidmanifest.xml
Coding R.java
Coding buildconfig.java
Coding mainactivity.java
Coding main.xml
Coding strings.xml
Coding drawables

TUTORIALS II
Java XML
Learning To Code

Create A Simple
Android App

Change App Icon

Add Text and Style

Add Buttons To App

Placing Text in
Buttons


Change View
Background Color


Change Screen
Orientation


Add Image to
Activity View


Add Horizontal
Scroll View


Add a Frame Layout

How to Add Themes
To Your App

How To Code
Customized Styles

Code a Toast Message

Coding Resource
Identifiers



from the Web
SPECIFIC CODING TASKS

Add Clickable Button
To textView

Image Button with
Selector

Linear Layout with
weight attribute

OnClick Displays
Message

Screen Density
Coding Practices


CODING ENVIRONMENTS

AIDE
for android tablets

Android Studio
For desktop computers


IMAGES ICONS FOR YOUR APPS

Code Canyon Paid From $1

IconFinder.com Free and Paid From $1


Our ARTICLES

App Distribution
Launching Your Android App
How To Be Successful

Android App Libraries
What are they and how
to implement them


ScrollView
How To Implement
ScrollView


View All Articles


Coding Tools

Android Studio
Course - Paid

Java Programming
Course - Free

Git Hub Course
Free



About Our Images

All images on this page are copyrighted material.
You can use the images included with each tutorial for the purpose of creating your android app. These images are not to be distributed or sold.

APP SIGNING KEY- GOOGLE


How To Add Your Google Key
To Manifest.xml
Web Article

How To Sign Your APK Web Article

Google Developer Console
Create Account Submit Your App
Web Article


APP SIGNING - AMAZON
Amazon App DRM - APK KEY
Amazon Developer Portal
Create Account - Submit Your App


MONETIZE YOUR APP
InMobi
AdMob
Google's In-App Billing for App monetization.

Monetizing Your App
How Tos




Tweets by @codeandroidapps