To customize a control:
1 Working principle of view2 Writing View class3 Adding attributes to the view class4 Drawing Screen5 Responding to user messages6 Custom Callback Functions
Java code
Copy Code code as follows:
Private class
Copy Code code as follows:
public class Activity01 extends activity
{
/** called the activity is a. */
@Override
public void OnCreate (Bundle savedinstancestate)
{
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.main);
Project Address: Https://github.com/JeasonWong/JikeGallery
Words are not much said, first on the effect.
This effect is in the Instant app see, feel very good, hence imitation.
First of all, my idea of implementation (above side of the picture
Broadcastreceiver is the system global broadcast listener class, the Main method is OnReceive (), the custom broadcast class inherits from it and implements its own onreceive () processing logicBefore broadcastreceiver use, registration Listening
Manifest.xml file:
Copy Code code as follows:
Android:name= ". Daemonservice "
Android:enabled= "true"
Android:process= ". Daemonservice ">
Note: Because we have to run the service in the background, we do not
1, Androidmanifest.xml will activity
Copy Code code as follows:
Android:name= "Com.suma.smartview.activity.LTVDetailActivity"
android:configchanges= "Keyboardhidden|orientation|screensize"/>
2, in the code
Copy
In fact, the word game program is very simple, is a view and an activity, in the use of Handier and Postinvalidate () Update UI
Call the Handler.post (Runnable R) method, Runnable run in the UI thread, so you can call View.invalidate directly ()
Look at the code directly, and the notes are written clearly.
Copy Code code as follows:
public class Mainactivity extends activity {
Private ImageView IV;
Private Bitmap Basebitmap;
Private Canvas Canvas;
Private Paint Paint;
When you refer to the local code should be based on the need for appropriate changes, there are redundant code small series did not delete. OK, nonsense not to say, everything let the code speak!
The key code looks like this:
The main code inside
Recently want to get a dual navigation function, look at a lot of information, finally realize the function, this side even give yourself a few notes!
Let's see the effect first.
So it's starting to happen!
The bottom navigation bar I choose to
First show you the effect of the picture, if it feels good, please refer to the realization of ideas:
We're going to implement a custom view of another circle that draws an arc, and the idea is this:
First you create a class Progressview,
First look at the effect chart:
The first of several problems encountered in the process:
1, the edittext to customize the background
2, the runtime automatic edittext automatically get focus
3, when the focus is to clear the hint, rather than
The activity that needs to use the dialog style pop-up box is often encountered in Android, first of all, we might first think of setting the android:layout_height= "Wrap_content" attribute in the XML layout file. Let the activity be highly adaptive,
This function can help you to achieve, in the picture of random smear, can be used for SNS products.
The drawing itself is simple, but it's a bit of a hassle to implement the exact (position, zoom) drawings that you specify on the picture.
Here's
Recently saw some applications when downloading files, and did not eject the progress bar, but very cool use the Start Download task button directly display the file download progress, by changing its background color, pushing from left to right,
Objective
A recent project requires iOS and Android to use a two-dimensional code to allow the scanned machine itself to identify the operating system implementation to jump to the corresponding download link. For example, the iphone using
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service