我想在我的应用程序的每一行的开头放置一个图像。问题是它缩小了图像太多 。我想让它占据整个空间。
主.xml:
<?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"
>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:id="@+id/tableView"
android:layout_height="fill_parent"
android:layout_weight=".90"
android:stretchColumns="1"
></TableLayout>
</ScrollView>
这就是我添加图像的方式:
TableLayout tableView = (TableLayout) findViewById(R.id.tableView);
TableRow row = new TableRow(this);
ImageView im;
Bitmap bmp;
im = new ImageView(this);
bmp=getbmp(s);
im.setImageBitmap(bmp);
row.addView(im, new TableRow.LayoutParams(70, 30));
tableView.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
如果我从TableRow.LayoutParams(70, 30));
图像中更改参数保持不变,则只有行变大/变小。此外,如果我使这些参数足够小,图像可能会变小,但这不是我想要做的。我 不一定 需要 整个 图片 , 一个 裁剪 的 放大 的 填充 那个 空间 也 很好 . 这是来自网站的示例图像。如果我这样放图像:row.addView(im);
图像变得太大,文本没有更多空间。