I hava a simple program about video recording . I use the surfaceView to show the preview screen. and I also w开发者_StackOverflowant to put some buttons on the screen.
I put all the component mentioned above into a XML file which is "ipcam.xml"
I use MediaRecorder , SurfaceView , SurfaceHolder to complete this program because the preview screen does not orientate correctly when I rotate my phone. so I use "setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);" but , the button in the program is always in LANDSCAPE direction . it will not auto change direction when I rotate my phone , but the preview is ok!!
so is there anyway to solve this problem.
Thank you all very much in advance.
you can see this picture , I put my phone in vertical direction the preview screen seems OK but the button is in horizontal direction , i don't want it.
https://newslab.csie.ntu.edu.tw/~poc7667/123.png
Try this:
<activity android:name=".MyActivity"
android:label="@string/app_title"
android:screenOrientation="landscape"
android:configChanges="keyboardHidden|orientation">
</activity>
Did you specify android:configChanges="keyboardHidden|orientation"
on your activity's configuration in the manifest.xml?
精彩评论