- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
i.putExtra(MediaStore.EXTRA_OUTPUT, MyFileContentProvider.CONTENT_URI);
startActivityForResult(i, CAMERA_RESULT);
这就是我在我的应用程序中调用相机的方式,因为我需要高质量的输出,所以我在两者之间使用了一个 contentProvider
。
Bitmap mBitmap = BitmapFactory.decodeFile(out.getAbsolutePath());
ImageView im1 = (ImageView)findViewById(R.id.camTemp);
im1.setImageBitmap(mBitmap);
和 onActivityResult()
,这就是我显示拍摄图像的方式。
在这两者之间,这是 contentProvider
类的代码。
public class MyFileContentProvider extends ContentProvider {
public static final Uri CONTENT_URI = Uri.parse
("content://obx.com.futurister/");
private static final HashMap<String, String> MIME_TYPES =
new HashMap<String, String>();
static {
MIME_TYPES.put(".jpg", "image/jpeg");
MIME_TYPES.put(".jpeg", "image/jpeg");
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
// Implement this to handle requests to delete one or more rows.
throw new UnsupportedOperationException("Not yet implemented");
}
@Override
public String getType(Uri uri) {
String path = uri.toString();
for (String extension : MIME_TYPES.keySet()) {
if (path.endsWith(extension)) {
return (MIME_TYPES.get(extension));
}
}
return (null);
}
@Override
public Uri insert(Uri uri, ContentValues values) {
// TODO: Implement this to handle requests to insert a new row.
throw new UnsupportedOperationException("Not yet implemented");
}
@Override
public boolean onCreate() {
try {
File mFile = new File(getContext().getFilesDir(), "newImage.jpg");
if(!mFile.exists()) {
mFile.createNewFile();
}
getContext().getContentResolver().notifyChange(CONTENT_URI, null);
return (true);
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
@Override
public ParcelFileDescriptor openFile(Uri uri, String mode)
throws FileNotFoundException {
File f = new File(getContext().getFilesDir(), "newImage.jpg");
if (f.exists()) {
return (ParcelFileDescriptor.open(f,
ParcelFileDescriptor.MODE_READ_WRITE));
}
throw new FileNotFoundException(uri.getPath());
}
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
// TODO: Implement this to handle query requests from clients.
throw new UnsupportedOperationException("Not yet implemented");
}
@Override
public int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
// TODO: Implement this to handle requests to update one or more rows.
throw new UnsupportedOperationException("Not yet implemented");
}
现在,问题是,我最终在ImageView
中获取的图像是portrait
,如何将其获取为landscape
默认情况下?
最佳答案
您可以轻松地旋转肖像图像并获得风景图像!
Matrix matrix = new Matrix();
matrix.postRotate(90);
Bitmap rotatedBitmap = Bitmap.createBitmap(bitmap , 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
关于java - Android Camera 将图像返回为肖像,将其作为风景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33055150/
在 iPad 应用程序中,我正在使用 UISplitViewController。 当应用程序以纵向模式启动时,我需要强制显示主弹出窗口。 现在我正在使用这段代码,它在 iOS 5.0 上运行良好。
我正在尝试以横向或纵向打印本地报告。 private void Export(LocalReport report) { Warning[] warnings; m_streams =
当通过 iPad 处于纵向模式时,我需要向左浮动一个 div。无论插入什么代码,都不会发生任何变化。这是我正在做的: @media only screen and (min-device-width
我的媒体查询不适用于 768px ipad 纵向。 如果我更改 min-width 效果很好,但在 桌面版本 或其他分辨率超过 769px 时会影响尺寸/p> @media only screen a
当我保存图像到 coreData 时,当我从 CoreData 重新打开它时,所有纵向拍摄的图像都是横向的。 我资助了很多关于它的预览问题,但都是在 Objective C 中而不是在 Swift 中
晚上,我在 ipad 肖像的媒体查询中遇到问题,这是我的代码。 @media (min-width: 768px) and (max-width: 1024px) and (orientation:
我已经使用 google api 进行人脸检测。所以我通过 firebase 进行了集成,还安装了 firebase 的框架。 Face Detection is working fine in iP
我有一张尺寸为 1400x800 的图像,我需要将其转换为 PDF,以便 PDF 处于纵向形式并在页面的上/下半部分包含图像。我需要使用 ImageMagick 6.4.8 2009-09-21,因为
我为每种设备设计了不同的偏移量和元素大小。 有没有办法为不同的iphone纵向设置不同的值(使用大小类或其他)(它们都是紧凑的|常规的)? 如果不是 - 解决此类任务的最佳方法是什么? 更新 例如,我
我是一名优秀的程序员,十分优秀!