1 <?XML version= "1.0" encoding= "Utf-8"?>2 <LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"3 android:orientation= "vertical"Android:layout_width= "Match_parent"4 Android:layout_height= "Match_parent">5 6 <TextView7 Android:layout_width= "Wrap_content"8 Android:layout_height= "Wrap_content"9 Android:text= "Demo effect"Ten Android:textcolor= "@color/text_color" One android:textsize= "25SP" A android:layout_gravity= "Center"/> - - <LinearLayout the Android:layout_width= "Match_parent" - Android:layout_height= "200DP"> - - <Horizontalscrollview + Android:layout_width= "Wrap_content" - Android:layout_height= "Match_parent"> + A <LinearLayout at Android:layout_width= "Wrap_content" - Android:layout_height= "Match_parent"> - - <View - Android:layout_width= "400DP" - Android:background= "#aaffff" in Android:layout_height= "Match_parent"/> - to <View + Android:layout_width= "400DP" - Android:layout_height= "Match_parent" the Android:background= "#ffff00"/> * $ </LinearLayout>Panax Notoginseng </Horizontalscrollview> - the </LinearLayout> + A <ScrollView the Android:fillviewport= "true" + Android:layout_width= "Match_parent" - Android:layout_height= "Wrap_content"> $ $ <LinearLayout - Android:layout_width= "Match_parent" - android:orientation= "vertical" the Android:layout_height= "Wrap_content"> - Wuyi <View the Android:layout_width= "Match_parent" - Android:background= "#aa5511" Wu Android:layout_height= "400DP"/> - About <View $ Android:layout_width= "Match_parent" - Android:layout_height= "400DP" - Android:background= "#ffff00"/> - A <TextView + Android:layout_width= "Match_parent" the Android:layout_height= "Wrap_content" - Android:text= "The use of ScrollView, there are two kinds." \ n vertical direction, horizontal direction. \ n The view can only be placed in one layout "/> $ the </LinearLayout> the the </ScrollView> the - </LinearLayout>
Java
1 PackageCom.example.alimjan.hello_world;2 3 Importandroid.app.Activity;4 ImportAndroid.content.Context;5 Importandroid.content.Intent;6 ImportAndroid.os.Bundle;7 Importandroid.support.annotation.Nullable;8 9 /**Ten * Created by Alimjan on 6/30/2017. One */ A - Public classClass__2_2_3extendsActivity { - @Override the protected voidonCreate (@Nullable Bundle savedinstancestate) { - Super. OnCreate (savedinstancestate); - Setcontentview (r.layout.code_2_2_3); - } + - Public Static voidstarthome (Context mcontext) { +Intent Intent =NewIntent (Mcontext, Class__2_2_3.class); A mcontext.startactivity (intent); at } -}
Android Development Notes ___ scrolling views __scroll view