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 );
}
};