tailieunhanh - professional android application development phần 10

Bắt đầu bằng cách tạo ra một dự án ContentSlider mới gồm có một cuối gói, nhập khẩu nhập khẩu nhập khẩu nhập khẩu nhập khẩu nhập | Chapter 11 Advanced Android Development TODO Do something when the animation repeats. public void onAnimationStart Animation _animation TODO Do something when the animation starts. Animated Sliding User Interface Example In this example you ll create a new Activity that uses an Animation to smoothly change the content of the User Interface based on the direction pressed on the D-pad. 1. Start by creating a new Contentslider project featuring a ContentSlider Activity. package import import import import import import import public class ContentSlider extends Activity @Override public void onCreate Bundle icicle icicle setContentView 2. Next modify the layout resource. It should contain a single TextView with the text bold centered and relatively large. xml version encoding utf-8 LinearLayout xmlns android http apk res android android orientation vertical android layout_width fill_parent android layout_height fill_parent TextView android id @ id myTextView android layout_width fill_parent android layout_height fill_parent android gravity center android textStyle bold android textSize 30sp android text CENTER android editable false android singleLine true android layout_margin 10px LinearLayout 365 Chapter 11 Advanced Android Development 3. Then create a series of animations that slides the current View out of and the next View into the frame for each direction left right up and down. Each animation should have its own file. . Create . set xmlns android http apk res android android interpolator @android anim accelerate_interpolator translate android fromYDelta -100 p android toYDelta 0 android duration 700 set . Create .

TỪ KHÓA LIÊN QUAN