android实现上下滑动 问答记录

布局最外包一层滚动条

1
2
3
4
5
6
7
8
9
10
11
12
13
 <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
 
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >
        </LinearLayout>
    </ScrollView>
    强制横竖屏
    在配置文件中对Activity节点添加android:screenOrientation属性(landscape是横向,portrait是纵向)
追问:
滑动弄了下是可以成功了,不过是放在第一个layout的下面,放在最外面出错了,

还有就是锁定横竖屏的没有实现,我的配置文件中原来是没有activity这个节点的,是不是这个节点除了这个属性之外还要什么属性的,是否是放在manifest之下
追答:
1
2
3
4
5
6
7
8
9
10
<activity
            android:name=".MainActivity"
            android:label="@string/app_name" 
            android:screenOrientation = "landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
 
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

安卓项目不可能没有activity节点的

posted @ 2015-08-03 16:04  统领七界  阅读(407)  评论(0编辑  收藏  举报