开发者

Retaining view orientation

I have an actoivity that implements the methods of SurfaceHolder and to work with camera. In the main layout, which is a LinearLayout, I inserted another LinearLa开发者_JS百科yout to act as an overlay and I setted the orientation to Landscape.

View overlayView = inflater.inflate(R.layout.cameraoverlay, null);
    this.addContentView(overlayView,
            new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));

    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

Because of this, the overlay, obviously, rotates too. And this is the problem. In the case of a dynamic view, how can I maintain the previously orientation of the overlay view?

Thanks for replies


set the activity orientation to landscape in the android manifest.

<activity android:name=".activity.NewSearchBrowserActivity" android:theme="@style/Theme.FullScreen" android:screenOrientation="landscape"></activity>

this override any later orientation on the activity and it´s inner views.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜