私はカメラの電話で画像を撮るアンドロイドアプリケーションを持っています。画像をImageView
に入れてください。次に画像の下部にテキストを設定します。 uは私を助けてください、私は次の何をすべき私に言うことができますいくつかのコードがいいだろうImageViewにテキストを設定します
ImageView image;
bitmap = android.provider.MediaStore.Images.Media
.getBitmap(cr, selectedImage);
image.setImageBitmap(bitmap);
:?
今まで私のような何かをやりました!
EDIT:XML
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1">
<Button
android:id="@+id/logoButton"
android:layout_height="wrap_content"
android:text="LogoButton"
android:layout_marginLeft="40dip"
android:layout_width="224dp">
</Button>
<ImageView
android:id="@+id/imageview"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
</ImageView>
UPDATE:
....onCreate(){
Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File image=new File(Environment.getExternalStorageDirectory(),"PhotoContest.jpg");
camera.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(image));
imageUri=Uri.fromFile(image);
startActivityForResult(camera,1);
}
public void onActivityResult(int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
switch(requestCode){
case 1:
if (resultCode == Activity.RESULT_OK) {
Uri selectedImage = imageUri;
getContentResolver().notifyChange(selectedImage, null);
image= (ImageView) findViewById(R.id.imageview);
ContentResolver cr = getContentResolver();
Bitmap bitmap;
try {
bitmap = android.provider.MediaStore.Images.Media
.getBitmap(cr, selectedImage);
image.setImageBitmap(bitmap);
Toast.makeText(this, selectedImage.toString(),
Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(this, "Failed to load", Toast.LENGTH_SHORT)
.show();
Log.e("Camera", e.toString());
}
}
else
if(resultCode == Activity.RESULT_CANCELED) {
Toast.makeText(EditPhoto.this, "Picture could not be taken.", Toast.LENGTH_SHORT).show();
}
}
}
1.I'mはわからないでframeLayoutと、このトリックは、テキストを置くこと:これは私がカメラを使用する方法であります私のイメージ上に...さらに私は写真をアップロードしたいので。私はウェブサイト上の写真をアップロードする場合テキストがまだそこにある???
2.私は写真を撮った後、それを水平に表示し、フルスクリーンでは表示しません。>私はそれをどのように修正できるか知っていますか?
を私はXML.I'm任意のヌル例外を取得していないを持っています! – adrian
私は自分の質問をXMLで編集しました。だから次は? – adrian
@george ImageViewの代わりにカメラのプレビューを直接見たいという私の答えを編集しました – Shlublu