问题描述
我在写这在纵向视图有一个画廊在顶部的应用程序,当你点击一个图片就会膨胀,填满整个屏幕。
I am writing an application which in portrait view has a gallery at the top and when you click a picture it will inflate and fill the entire screen.
这可是工作在横向模式下的库涵盖了大部分的图片,并在总体看起来糟糕。
This works however in landscape mode the gallery covers up most of the picture and it in general looks crappy.
我犯了一个GridView为横向模式。现在我遇到的问题是它从画廊活动更改到GridView活动时的方向变化。任何想法?
I made a GridView for landscape mode. The problem I am having now is to change it from the gallery activity to the Gridview activity when the orientation changes. Any ideas?
推荐答案
添加到您的活动:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
startActivity(newActivity)
}
请注意,这是一个坏主意。其实,这是一个非常糟糕的主意。一个更好的选择是要么力一个方向或创建一个布局上的两个方向看起来不错。
Note that this is a bad idea. Actually, it's a really bad idea. A much better alternative would be to either force one orientation or to create a layout that looks great on both orientations.
这篇关于如何启动一个新的活动时,屏幕方向变化?安卓的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!