gpt4 book ai didi

Android 在 ImageView 中对齐顶部位图

转载 作者:太空狗 更新时间:2023-10-29 15:29:50 26 4
gpt4 key购买 nike

无论如何,我可以在 ImageView 中对齐位图。我的 ImageView 有问题。我通过 Java 代码设置它的源代码,在调整位图大小后,它位于 ImageView 的中心,但我想要的是对齐位图。

声明 ImageView :

    <RelativeLayout
android:id="@+id/collection_background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/actionbar" >


<ImageView
android:id="@+id/collection_image_background"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:contentDescription="@string/stampii" />

// countinue ........

这是我设置位图的方式:

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

任何ides如何做到这一点?

最佳答案

android:scaleType="fitStart" 添加到您的 ImageView。对我来说没问题。

关于Android 在 ImageView 中对齐顶部位图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10223787/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com