constructor:
Public GradientDrawable (GradientDrawable. Orientation orientation, int [] colors)
Orientation specifies the gradient direction (the above eight types). The gradient color is specified by the colors array, and each value in the array is a color.
This example defines a gradient direction from top left to bottom right of the Group. The gradient colors are red, green, and blue.
[Java]MDrawable = new GradientDrawable (GradientDrawable. Orien
This example introduces several styles of ScrollView. android: scrollbarStyle is used to define the style and position of the scroll bar. the scroll bar can be in the "overlaid" or "inset" format. When the "inset" style is used, add the scroll bar to the Padding area of the View. The scroll bar can be displayed in the Padding area of the View or on the edge of the View.
ScrollbarStyle has the following styl
Android User interface Exhaustive tutorial example 1.Alarmmanager Tutorial instance of Android user interface SummaryHttp://www.apkbus.com/android-48405-1-1.html 2.Examples of text editing tutorials for Android user interface SummaryHttp://www.apkbus.com/
This example describes the bitmap usage in Android. Share to everyone for your reference. Specifically as follows:
The image formats you can support in the Android SDK are as follows: PNG, JPG, GIF, and BMP.
Creation of 1.Bitmap
With the help of Bitmapfactory.
1 The picture in the resource
Using Bitmapfactory to get bitmaps
Copy Code code as follows:
Canvas provides drawArc to draw an arc.
Public void drawArc (RectF oval, float startAngle, float sweepAngle, boolean useCenter, Paint)
Oval: Specifies the rectangular area of the outer contour of the arc.StartAngle: the starting angle of the arc, measured in degrees.SweepAngle: the angle of the arc scanning. It is clockwise and measured in degrees.UseCenter: if it is True, the center of the circle is included when the arc is drawn, which is usually us
1.WebView Tutorial Example Summary of Android user interfaceHttp://www.apkbus.com/android-51718-1-1.html2.Notification Tutorial Example Summary of Android user interfaceHttp://www.apkbus.com/android-51696-1-1.html3.The
The Drawable of the Android platform represents the resources that can be drawn on the screen. You can use getDrawable (int) to obtain the Drawable resource from the resource file, or use @ drawable in the XML resource file to reference A drawable resource.
Drawable resources can be divided into Bitmap, Nine-Patch, Layer List, State List, Level List, Transition, Insert, Clip, Scale, and Shape.
In this example
}///Save the current x coordinate value OLDX = x;
Save the current y-coordinate value oldy = y;
Candraw = true;
return true; }
}
Application test
Running this application on the emulator has the following effect:
The effect of running on Android phones is this:
The handwriting is a bit ugly, but the function is realized. After getting the y-coordinate minus an offset value of 50, this value is guessed, did not
On Android, most applications are developed based on Java. To use C or C ++ programs or libraries, you need to use ndk. Ndk is short for Native Development Kit. It is a tool set that integrates the cross-compiling environment of Android and provides a set of convenient makefiles to help developers quickly develop C or C ++ dynamic libraries, and automatically package the so and Java programs into APK to run
In this example, a simple Integer Calculator applies multi-touch operations: One Touch operation is addition operations, two touch operations are subtraction operations, three touch operations are multiplication operations, and four touch operations are Division operations. The option menu is also added. The options include exit, help, and clear.:
Specific Code:MainActivity. java1. package com. lingdududu. test;2.3. import
This example is similar to the previous example. You only need to change the orientation of one LinearLayout from vertical to horizontal, and remove android: layout_gravity = "center_vertical"
Android: orientation = "horizontal"Android: layout_width = "match_parent"
This example describes the use of Android sprite animations. Share to everyone for your reference. Specifically as follows:
Elaineanimated.java files are as follows:
Package Net.obviam.walking.model;
Import Android.graphics.Bitmap;
Import Android.graphics.Canvas;
Import Android.graphics.Paint;
Import Android.graphics.Rect;
public class Elaineanimated {private static final String TAG = ElaineAnimated
This example describes the Android basic game cycle. Share to everyone for your reference. as follows:
Desired FPS private final static int max_fps = 50;
Maximum number of frames to be skipped private final static int max_frame_skips = 5;
The frame period private final static int frame_period = 1000/max_fps;
@Override public void Run () {Canvas
().
The layout_width attribute cannot be specified for the subview of TableLayout. Its value is always MATCH_PARENT, while layout_height can be specified. The default value is WRAP_CONTENT. If the subview type of TableLayout is TableRow, The layout_height is.
Cells must be added to each row in sequence (XML or code). The column sequence number starts from 0. If no class sequence number is specified for the cell, it is automatically added to the next column, if a column is skipped, The skipped c
This article is an example of Android to achieve Youdao Dictionary query function method. Share to everyone for your reference, specific as follows:
This is what I do a simple Youdao Android demo, just a simple prototype. The interface design is also a bit ugly oh ~ look at the following effect chart:
The first step: the analysis of Ideas
A total of three co
The example of this article is an analysis of Android multithreading. Share to everyone for your reference, specific as follows:
There is also the concept of multithreading under Android, in C + +, a child thread can be a function, generally a function with a loop to handle some data, the priority thread is only a complex operation, so it may not need a while lo
This example describes the Android subtraction operation based on reflection technology. Share to everyone for your reference, specific as follows:
Java Reflection mechanism Definition:
The Java reflection mechanism is in the running state, and for any class, all the properties and methods of the class are known, and any one of its methods can be invoked for any object, and this dynamically acquired infor
Applications can also use external buckets such as SD cards to access resources. This example describes how to use an external bucket to create and delete files.
In this example, the SD card is used to create files in three locations. The two files are private to the application. with the deletion of the application, the other is the Picuture directory on the shared SD card. The two private directories are
Recently studied the Gobang course, the feeling is very good. Then I wrote an android program about Gobang that I could learn a lot from. Now we begin the process of writing the Gobang program today. The source code of the program please see links:
OK, now we're going to build the project Step-by-step, starting with the following project chart:
Run the effect diagram:
Some pre-preparation code
1, the main activity class mainactivity, added in
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.