在我的Android应用程序中,当我旋转设备(滑出键盘)然后我Activity重新启动(onCreate被调用).现在,这可能是它应该如何,但我在onCreate方法中做了很多初始设置,所以我需要:
onCreate不会再次调用,布局只是调整或onCreate不调用.我一直试图找出如何使用FFmpeg旋转视频.我正在处理以纵向模式拍摄的iPhone视频.我知道如何使用MediaInfo(优秀的库,顺便说一句)确定当前的旋转度,但我现在卡在FFmpeg上.
根据我的阅读,您需要使用的是vfilter选项.根据我的看法,它应该是这样的:
ffmpeg -vfilters "rotate=90" -i input.mp4 output.mp4
Run Code Online (Sandbox Code Playgroud)
但是,我不能让这个工作.首先,-vfilters不再存在,它现在只是-vf.其次,我收到此错误:
No such filter: 'rotate'
Error opening filters!
Run Code Online (Sandbox Code Playgroud)
据我所知,我有一个FFmpeg的全选版本.运行ffmpeg -filters显示:
Filters:
anull Pass the source unchanged to the output.
aspect Set the frame aspect ratio.
crop Crop the input video to x:y:width:height.
fifo Buffer input images and send them when they are requested.
format Convert the input video to one of the specified pixel formats.
hflip Horizontally flip the input video.
noformat …Run Code Online (Sandbox Code Playgroud) 我正在捕捉图像并将其设置为图像视图.
public void captureImage() {
Intent intentCamera = new Intent("android.media.action.IMAGE_CAPTURE");
File filePhoto = new File(Environment.getExternalStorageDirectory(), "Pic.jpg");
imageUri = Uri.fromFile(filePhoto);
MyApplicationGlobal.imageUri = imageUri.getPath();
intentCamera.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intentCamera, TAKE_PICTURE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intentFromCamera) {
super.onActivityResult(requestCode, resultCode, intentFromCamera);
if (resultCode == RESULT_OK && requestCode == TAKE_PICTURE) {
if (intentFromCamera != null) {
Bundle extras = intentFromCamera.getExtras();
if (extras.containsKey("data")) {
bitmap = (Bitmap) extras.get("data");
}
else {
bitmap = getBitmapFromUri();
}
}
else {
bitmap = getBitmapFromUri();
}
// …Run Code Online (Sandbox Code Playgroud) 我有一个我想阻止旋转的活动,因为我正在启动AsyncTask,屏幕旋转使它重新启动.
有没有办法告诉这个活动"即使用户像疯了一样摇动他的手机也不要旋转屏幕"?
自动布局让我的生活变得困难.从理论上讲,当我切换时它会非常有用,但我似乎总是在打架.
我做了一个演示项目试图找到帮助.有没有人知道如何在调整视图大小时使视图之间的间距均匀增加或减少?
这是三个标签(手动间隔垂直):

我想要的是让他们在旋转时均匀地调整间距(而不是视图大小).默认情况下,顶视图和底视图朝中心方向挤压:

<img class="image" src="" alt="" width="120" height="120">
Run Code Online (Sandbox Code Playgroud)
无法让这个动画图像工作,它应该做360度旋转.
我想下面的CSS有些不对劲,因为它只是保持不动.
.image {
float: left;
margin: 0 auto;
position: absolute;
top: 50%;
left: 50%;
width: 120px;
height: 120px;
margin-top: -60px;
margin-left: -60px;
-webkit-animation-name: spin;
-webkit-animation-duration: 4000ms;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
-moz-animation-name: spin;
-moz-animation-duration: 4000ms;
-moz-animation-iteration-count: infinite;
-moz-animation-timing-function: linear;
-ms-animation-name: spin;
-ms-animation-duration: 4000ms;
-ms-animation-iteration-count: infinite;
-ms-animation-timing-function: linear;
animation-name: spin;
animation-duration: 4000ms;
animation-iteration-count: infinite;
animation-timing-function: linear;
@-ms-keyframes spin {
from {
-ms-transform: rotate(0deg);
} to {
-ms-transform: rotate(360deg);
}
}
@-moz-keyframes spin {
from { …Run Code Online (Sandbox Code Playgroud) 我使用-webkit-transform(和-moz-transform/-o-transform)来旋转div.还有固定的位置,所以div与用户一起缩小.
在Firefox中它工作正常,但在基于webkit的浏览器中,它已经破碎了.使用-webkit-transform后,固定的位置不再起作用!怎么可能?
我使用以下代码在ImageView中旋转图像一个角度.有没有更简单,更简单的方法可用.
ImageView iv = (ImageView)findViewById(imageviewid);
TextView tv = (TextView)findViewById(txtViewsid);
Matrix mat = new Matrix();
Bitmap bMap = BitmapFactory.decodeResource(getResources(),imageid);
mat.postRotate(Integer.parseInt(degree));===>angle to be rotated
Bitmap bMapRotate = Bitmap.createBitmap(bMap, 0, 0,bMap.getWidth(),bMap.getHeight(), mat, true);
iv.setImageBitmap(bMapRotate);
Run Code Online (Sandbox Code Playgroud) 当我将媒体库中的图像加载到位图时,一切都运行正常,除了在垂直拿着手机时用相机拍摄的图片被旋转,以便我总是得到水平图片,即使它在画廊.为什么这样,我怎么能正确加载它?