2012-10-09 47 views
0

我使用ICS源代码中的原创Gallery应用程序。现在的事情是,我想禁用水平滚动并通过Grid中的垂直滚动来实现它。这个怎么做 ?如何禁用水平滚动视图?

+0

看到这个http://stackoverflow.com/questions/5763304/disable-滚动视图,编程 – vnshetty

回答

0

尝试这样做的这个

Add android:screenOrientation="portrait" to the activity in the AndroidManifest.xml. For example:

<activity android:name=".SomeActivity" 
      android:label="@string/app_name" 
      android:screenOrientation="portrait"> 

或者尝试像这样...

一个编程的方式,我能想到的,是创建延伸的超类活动并从那里扩展你的所有课程。

已在受保护的方法在超类下面的设置和调用super.xxx()来启动这样的:

setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 

如果您有什么不同的方式具体的活动,你可以简单地覆盖这个。

[我没有试过呢,但OOP的知识这部作品]

0

试试这个:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 

<ScrollView android:id="@+id/ScrlView" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" > 

<Gallery android:id="@+id/gallery" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:gravity="bottom"/> 

</ScrollView> 
</LinearLayout>