开发者

Retaining view orientation

开发者 https://www.devze.com 2023-02-18 08:12 出处:网络
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

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

精彩评论

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