質問

私は、XMLでImageViewの(image_view)を有し、私は中心に配置重力セットとcenter_insideにスケールが設定されている....私はimage_viewに自分圧縮BMPを通過するとき、それは、中にそれを置きますこの問題を回避するには...(ポートレートモードでの)画面の任意のアイデアを残し?

ここで私がイメージビューに設定されます:

        ImageView imageView = (ImageView) findViewById(R.id.image_view);

        imageView.setImageBitmap(bitmap565);

私はまた、出力ストリームにそれを圧縮します:

        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();
        }

おかげですべての!

    <ImageButton android:id="@+id/ImageButton01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/results" android:layout_gravity="top|center"></ImageButton><ImageView
            android:screenOrientation="portrait"
            android:layout_width="fill_parent"
            android:id="@+id/image_view"
            android:layout_gravity="center" android:layout_weight="1.0" android:layout_height="wrap_content" android:scaleType="centerInside"/>

    <Button
            android:screenOrientation="portrait"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal" android:layout_width="fill_parent" android:textStyle="bold" android:id="@+id/detect_face" android:text="Detect"/>

役に立ちましたか?

解決

あなただけでframeLayoutを使用して、あなたの問題を解決することができます。

<強いです>          の

他のヒント

ImageViewは親の内部の水平方向の位置に影響を与えないように、

はあなたのlayout_widthfill_parentは、layout_gravityに設定されています。代わりにgravitylayout_gravityを使用してみてください、またはwrap_contentの代わりにfill_parent

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top