我的Blog我做主^_^

          走向一條通往JAVA的不歸路...

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            64 隨筆 :: 68 文章 :: 77 評論 :: 0 Trackbacks

          在LinearLayout外面包一層ScrollView即可,如下代碼

          Apidemo 中關于如何使用ScrollView說明,請參考:
          <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:頁面跳轉的實現(不同activity間的切換)

          java代碼 加在button哪里同時在AndroidManifest.xml 哪里加上一句話,放在第一個activity 的下面

          xml:代碼:

          <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> //添加標簽屬性與values/report.xml對應

              </application>
              <uses-sdk android:minSdkVersion="3" />

          </manifest>

           

           

           

          跳轉代碼:

          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跳轉到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帶參數跳轉
                 bundle.putString("KEY_HEIGHT",field_height.getText().toString());
                 bundle.putString("KEY_WEIGHT",field_weight.getText().toString());
                 intent.putExtras(bundle);
                 startActivity(intent);
              }
              };



          posted on 2011-05-06 16:28 java_蟈蟈 閱讀(7475) 評論(0)  編輯  收藏 所屬分類: Android
          主站蜘蛛池模板: 乌兰察布市| 喜德县| 涿鹿县| 博湖县| 积石山| 株洲市| 米泉市| 固始县| 剑阁县| 宁强县| 琼海市| 南投县| 海兴县| 清苑县| 马公市| 长阳| 江津市| 祁阳县| 景洪市| 扶绥县| 石狮市| 图们市| 盘山县| 陕西省| 遵义市| 莱芜市| 武川县| 巴南区| 乌拉特前旗| 沙洋县| 阿图什市| 芦山县| 迭部县| 昆山市| 郴州市| 阆中市| 永兴县| 通州市| 临汾市| 饶阳县| 翼城县|