画像を相対レイアウトの上に揃えようとしています。その後、画像を水平方向に中央に配置します。私が使用しているコードは次のとおりです。
<ImageView
android:id="@+id/collection_image_background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
、しかし、このコードは機能していません。画像は中央に配置されていますが、相対レイアウトの上部に配置されていません。で試してみましandroid:scaleType="fitStart"
たが、実際には親の左と上にimagを揃えています。
必要に応じて画像を正しく配置する方法はありますか?
PS画像を次のように設定していることを忘れていますImageView
:
BitmapFactory.Options o2 = new BitmapFactory.Options();
o2.inTempStorage = new byte[8*1024];
ops = BitmapFactory.decodeStream(cis,null,o2);
ImageView view = (ImageView) findViewById(R.id.collection_image_background);
view.setImageBitmap(ops);