私はxml
ファイルのLinearLayout
の中に中心を置くImageView
を持っています。私は写真をスナップし、顔を検出し、それをImageView
に表示します。問題は、常に私の携帯電話の左側に表示されている(私は、アプリケーションが永久にportrait
モードに設定されている)... width
をfill_parent
にして、height
を修正したいどのように表示されるかについては何もしていない。私はImageView
にbitmap
を設定する場所私の人生のために私の画像が正しく表示されない理由を把握することができません
<ImageButton
android:id="@+id/YesButtonTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/yesface"
android:layout_gravity="top|center" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/image_view"
android:gravity="center"
android:layout_weight="1.0"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/message"
android:gravity="center_horizontal"
android:padding="10dip"/>
<Button
android:layout_gravity="center_horizontal"
android:layout_width="fill_parent"
android:textStyle="bold"
android:id="@+id/action_button"
android:selectAllOnFocus="false"
android:layout_height="100dip"
android:text="Click here to crop detected face"/>
ここにある:
((Button) findViewById(R.id.action_button))
.setOnClickListener(btnClick);
mTheMessage.setText(R.string.faceMessage);
mThePicture = (ImageView) findViewById(R.id.image_view);
mThePicture.setImageBitmap(bitmap565);
ここ
は私xml
コードがありますその後、圧縮された
Bitmap bitmap565 = Bitmap.createBitmap(width, height, Config.RGB_565);
:は、以下のように定義されて
try {
FileOutputStream fos = new FileOutputStream(filepath);
bitmap565.compress(CompressFormat.JPEG, 90, fos);
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
私はImageView
にbmp
を表示する前に。誰でも何故行動しないのか、そしてImageView
は正しく考えられますか?
の効果が得られます...私はXMLに私がやりたいことができるように思われますファイル、それはまだ同じ方法を表示する - 私は私のクラスで何か間違っていることができますか? – Sapp
私は排除のプロセスを行います。 XMLの他のすべてを取り出し、それがどのように見えるかを見てください。必要に応じて表示されるまで作業してから、他のウィジェットを追加してください。 – Eliseo