Android custom effects-random lottery and android custom Lucky Draw

Source: Internet
Author: User

Android custom effects-random lottery and android custom Lucky Draw

When I browsed the android open source code that day, I saw a custom effect of the wheel menu, which is similar to the kind of turntable lottery of others. I read the project and thought it was very fun, but I didn't want to change it on him, so I thought about a similar Instant Lottery effect, and I felt better than him. The open source project address: https://github.com/anupcowkur/Android-Wheel-Menu

My project: http://download.csdn.net/detail/u012321815/8036345

At first, I wanted to create an application that invited everyone to dinner. However, this is a dynamic process, indicating that this dynamic process will not be displayed in the blog, so you have to make up your mind. In fact, after you click "RUN", the red box will appear from one of the eight, and then a round tour, fast and slow, and finally stop on one. This effect should be more common and can be supplemented. Take a few screenshots at random.

This is the initial interface. There are only a few people and run in the middle. Click here to modify these names. Of course, you can change them to any text you want.

The modification is successful.

As I said just now, this is a dynamic process, so after you click the run in the middle, the red box will immediately start to rotate cyclically from a starting point. The above picture is a screenshot taken at any time. We can see that "RUNNING" is not "RUN" in the middle.

The dynamic process is like this. First, quickly turn, then gradually slow down, and finally stop at a certain level. Then, the top textview will be displayed accordingly, and "RUN" will be returned in the middle ".

If you want to see the dynamic effect, go to the project.

I said that this was initially guided by the open-source project, and the result was not going back. Later I thought about how simple it would be to use the gridview. It can be seen that thinking twice is far more important than writing a program directly.

Zookeeper


Pop-up window on the custom interface of Android Development

ViewDialog = (Button) findViewById (R. id. viewdialog );
ViewDialog. setOnClickListener (new View. OnClickListener (){
@ Override
Public void onClick (View v ){
ShowDialog ();
}
});
Public void showDialog (){
Dialog dialog = new Dialog (Main. this, R. style. DialogStyle );
Dialog. requestWindowFeature (Window. FEATURE_NO_TITLE );
Dialog. getWindow (). setFlags (WindowManager. LayoutParams. FLAG_FULLSCREEN,
WindowManager. LayoutParams. FLAG_FULLSCREEN );
Dialog. setContentView (R. layout. dialog );
Dialog. show ();
// WindowManager. LayoutParams params = dialog. getWindow (). getAttributes ();
// Params. width = 800;
// Params. height = 550;
// Dialog. getWindow (). setAttributes (params );
}

Dialog. xml
<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout xmlns: android = "schemas.android.com/apk/res/android"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: orientation = "vertical">
<ListView
Android: id = "@ + id/listview"
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"/>
</LinearLayout>
The comment part is to set the dialog size.
Listview is the same as adding a listview component in the activity. when defining the listview component, add dialog. findbyid (...). There are a lot of information on the arrayadapter online, just take a look at... the remaining full text>
 
How does android implement custom tab?

Use absolute Layout
<RelLayout>
<TableView android: layout_w = "wrap"
Android: layout_h = "wrap"
Android: layout_magintop = "How many dip"
Android: layout_maginleft = "How many dip"
Android: layout_maginright = "dip"
Android: layout_maginbuttom = "How many dip"
/>
<RelLayout>

Adjust the size by yourself.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.