Scroll the android screen page and jump to the page

Source: Internet
Author: User

In

Enter a scrollview outside linearlayout, as shown in the following code:

For details about how to use scrollview in apidemo, refer:
<Scrollview xmlns: Android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: scrollbars = "NONE">

<Linearlayout
Android: Id = "@ + ID/layout"
Android: Orientation = "vertical"
Android: layout_width = "fill_parent" Android: layout_height = "wrap_content">

<Textview
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: text = "@ string/scroll_view_1_text_1"/>

<Button
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: text = "@ string/scroll_view_1_button_1"/>
<Textview
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: text = "@ string/scroll_view_1_text_6"/>

<Button
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: text = "@ string/scroll_view_1_button_6"/>

</Linearlayout>
</Scrollview>
2: page Jump implementation (switching between different activities)

The Java code adds a sentence to the button and androidmanifest. XML, which is placed under the first activity.

XML: code:

<Activity Android: Name = "BCD" Android: Label = "@ string/bcd_title"> </activity>

<? XML version = "1.0" encoding = "UTF-8"?>
<Manifest xmlns: Android = "http://schemas.android.com/apk/res/android"
Android: versioncode = "1"
Android: versionname = "1.0" package = "com. Demo. Android. autognosis">
<Application Android: icon = "@ drawable/icon" Android: Label = "@ string/app_name">
<Activity Android: Name = ". autognosis"
Android: Label = "@ string/app_name">
<Intent-filter>
<Action Android: Name = "android. Intent. Action. Main"/>
<Category Android: Name = "android. Intent. Category. launcher"/>
</Intent-filter>
</Activity>
<Activity Android: Name = "BCD" Android: Label = "@ string/bcd_title"> </activity> // Add a tag attribute that corresponds to values/report. xml

</Application>
<Uses-SDK Android: minsdkversion = "3"/>

</Manifest>

 

 

 

Jump code:

Private void setlistensers (){
Log. D (TAG, "set listensers ");
Button_next.setonclicklistener (bt_next );
}
Private button. onclicklistener bt_next = new button. onclicklistener (){
Public void onclick (view v ){
// Switch to BDC page to jump to BDC. Class
Intent intent = new intent ();
Intent. setclass (autognosis. This, BCD. Class );
Startactivity (intent );
Intent intent = new intent ();
Intent. setclass (BMI. This, report. Class );
Bundle bundle = new bundle (); // bundle with parameter jump
Bundle. putstring ("key_height", field_height.gettext (). tostring ());
Bundle. putstring ("key_weight", field_weight.gettext (). tostring ());
Intent. putextras (bundle );
Startactivity (intent );
}
};

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.