Android activity jump animation makes your APP instantly beautiful, androidactivityapp

Source: Internet
Author: User

Android activity jump animation makes your APP instantly beautiful, androidactivityapp

We all know that beautiful apps will always give users a fresh feeling. In order to seize the user's larger network companies to make their products more beautiful, the most simple effect is the Activity jump effect, it not only makes the user look comfortable, but it is also very simple to implement. Let's achieve these effects and say goodbye to the original ecological jump effect!

First, create an Android project named AndroidSwitch. I really don't know what the name is, so I have a name like this. First, let's take a look at the XML Code. The Code for a LIstview is as follows:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:orientation="vertical" >    <ListView        android:id="@+id/listView1"        android:layout_width="match_parent"        android:layout_height="wrap_content" >    </ListView></LinearLayout>
The ListView in this XML file is mainly responsible for displaying click events of some effects. The text of the displayed effects will be placed in Values and shared with you in the same project! Jump effect. the most important part of the jump effect is animation ,. there is no animation to talk about the effect, so we create an anim file in the res file to put a variety of animations, there are a lot of animations, I will give a simple XML. I will give you a project. You can check it for yourself! As follows:

<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" >    <translate        android:duration="2000"        android:fromXDelta="0"        android:toXDelta="-100%p" /></set>
Isn't it easy? Well, even if the animation has been edited, where do we need to call it. by the way, we also need a jump to SecondActivity. In this SecondActivity, I only put a Button for the return, so it is not so troublesome to press the Back key, it only serves to show the effect of the first Activity jump, let me see. as follows:

package com.zqy.androidswitch;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;public class SecondActivity extends Activity{@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.act_second);final Button button=(Button) findViewById(R.id.button1);button.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {finish();}});}}
Well, it's almost half done. I need to write the implementation code, which is the core. Let's see how the core code is implemented:
package com.zqy.androidswitch;import java.util.ArrayList;import java.util.List;import android.os.Bundle;import android.app.Activity;import android.content.Intent;import android.view.View;import android.widget.AdapterView;import android.widget.ArrayAdapter;import android.widget.ListView;import android.widget.AdapterView.OnItemClickListener;public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);final ListView listView = (ListView) findViewById(R.id.listView1);String[] ls = getResources().getStringArray(R.array.anim_type);List<String> list = new ArrayList<String>();for (int i = 0; i < ls.length; i++) {list.add(ls[i]);}ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, list);adapter.setDropDownViewResource(android.R.layout.simple_list_item_1);listView.setAdapter(adapter);listView.setOnItemClickListener(new OnItemClickListener() {@Overridepublic void onItemClick(AdapterView<?> parent, View view,int position, long id) {Intent intent = new Intent(MainActivity.this, SecondActivity.class);startActivity(intent);switch (position) {case 0:overridePendingTransition(R.anim.fade, R.anim.hold);break;case 1:overridePendingTransition(R.anim.my_scale_action,R.anim.my_alpha_action);break;case 2:overridePendingTransition(R.anim.scale_rotate,R.anim.my_alpha_action);break;case 3:overridePendingTransition(R.anim.scale_translate_rotate,R.anim.my_alpha_action);break;case 4:overridePendingTransition(R.anim.scale_translate,R.anim.my_alpha_action);break;case 5:overridePendingTransition(R.anim.hyperspace_in,R.anim.hyperspace_out);break;case 6:overridePendingTransition(R.anim.push_left_in,R.anim.push_left_out);break;case 7:overridePendingTransition(R.anim.push_up_in,R.anim.push_up_out);break;case 8:overridePendingTransition(R.anim.slide_left,R.anim.slide_right);break;case 9:overridePendingTransition(R.anim.wave_scale,R.anim.my_alpha_action);break;case 10:overridePendingTransition(R.anim.zoom_enter,R.anim.zoom_exit);break;case 11:overridePendingTransition(R.anim.slide_up_in,R.anim.slide_down_out);break;default:break;}}});}}
You can use Listview to display click events of various effects. We can click what kind of animation the LIstview performs Based on the clicked position. I don't know how to make a GIF image on the mobile phone. I will show it on the homepage. You can download the Demo later.


Well, it's basically finished. Isn't it very simple? With these animations, your APP will have a beautiful landscape and can be used directly in the project! In the last sentence, Do not spray. This is suitable for beginners!

Click here to download the source code














Small user experience details: how to make the WEB link jump to the APP perfectly

Developers have been paying attention to the seamless cross-platform experience between PCs, tablets, and smartphones for a long time. For example, Evernote will develop software versions on almost all platforms to ensure that users are using different versions... when smartphone shipments exceed PC and functional mobile phones, and the proportion of apps used by users exceeds 80%, the smartphone App has definitely become the main character of people's lives. Developers have been paying attention to the seamless cross-platform experience between PCs, tablets, and smartphones for a long time. For example, Evernote will develop software versions for almost all platforms to ensure that users can seamlessly switch between different platforms. In addition, the Chrome desktop version and mobile terminal can also synchronize data, I open several web pages on my computer and can still see those pages when I switch to my mobile phone. Although many people have realized the importance of the App, there is still a huge experience gap between PC and mobile App. There are still many things to be done from the PC segment to the mobile end. For example, we will talk about how to perfectly switch from a webpage link on a PC or mobile phone to an App after a large number of apps are shared on Weibo or Weibo. During my nearly one-month testing, I found that most apps did not make a good transition from a Web link to an App. For example, if I use a mobile phone to open a link to an official Weibo account on Weibo, the link content is the content in the App (shared by Weibo ), then you will find that most of the cases are web pages. Although this application is installed on my mobile phone, it is still on the web version. If the App needs to be logged on, I cannot even perform more operations on the web version. Of course, some apps are doing very well in the process of linking to the App. In general, there will be four types of redirection Optimization Based on the design's seamless degree, which is summarized as follows (in this statement, I personally prefer all the apps I tested, therefore, there is no target product.) First, the link is designed for the PC and has not been optimized for mobile devices, to open a link, you must zoom in and out to view the content on the webpage. There are many such apps, such as public comments, fruit shells, fruit libraries, and upbar. Second, the link is optimized for mobile devices, but there is still a fault from the webpage end to the mobile end. For example, meile time officially recommends some song tickets. I can play them directly after opening them in a browser. The mobile experience is great, but even after login, I cannot add to my favorite songs. If I want to add some songs to my favorites, I have to open my website on my computer, search for the songs, and synchronize them to the meile time App. This is very troublesome. In addition, this type of App also has: Want to go, Meituan and so on. Another scenario is media applications. The content produced by the media itself is only an article, so it is easy to optimize for mobile devices. However, there are two categories. One type of webpage has a very good experience on mobile devices, and there are clients, but the two have faults. The second type is to optimize the mobile terminal. However, because there is no client, there will be no problem with the experience fault. Third: the product itself is born for mobile. Even the web version is as simple as the Mobile End. This type of link is open without any pressure, even if you log on, it is very convenient. You can directly use the web version for various operations, and then open the App to synchronize. This situation is already very good, but it still cannot solve the gap between the webpage link and the App. I cannot open the App directly through the webpage link. There are few such products, such as the early fruit Library (no web version) and Fancy outside China.

Android and activity jump problems. eclipse can compile and run, but the activity_02 error always occurs when you press the button on the simulator.

The Activity_02 listener is not added to the XML main configuration file. be careful next time. Please adopt. Thank you.

Related Article

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.