如何动态设置重力?
Bitmap bmp;
im = new ImageView (this);
bmp=getbmp(img);
im.setImageBitmap(bmp);
现在我想把图像放在顶部。我可以在没有的情况下做到这一点吗android:gravity
在 main.xml 中?
EDIT :
主文件
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:scrollbars="vertical"
>
</ScrollView>
我有一个框架布局,我向其中添加图像,然后添加文本,我希望图像位于屏幕顶部。
FrameLayout fm = new FrameLayout (this);
fm.addView(im);
fm.addView(fin); // fin = the text view
setContentView(fm);
Use ImageView.setScaleType()
with ImageView.ScaleType.FIT_START
作为价值。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)