実際には、ボタンのクリック時に ImageButton のサイズを変更しようとすることで、私のレイアウトには ImageButtons のみが含まれているため、別の方法でズームを実装しようとしていました。しかし、私が直面している問題は、ボタンが TableRow 内で膨張し、さらに TableRow が TableLayout で膨張していることです。
LAYOUT1.xml
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/TabScrollView" >
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="@+id/RelativeLayoutTable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/TabScrollView"
android:background="@drawable/blackbackground" >
<TableLayout
android:id="@+id/elementTable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="2dp"
android:layout_y="2dp"
android:orientation="horizontal" >
</TableLayout>
</TableLayout>
</RelativeLayout>
</ScrollView>
</HorizontalScrollView>
LAYOUT2.xml
<?xml version="1.0" encoding="utf-8"?>
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/elementRow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</TableRow>
LAYOUT3.xml
<?xml version="1.0" encoding="utf-8"?>
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/elementImage"
android:layout_width="100px"
android:layout_height="100px"
android:background="@null"
android:onClick="onClick"
android:padding="3dip"
android:scaleType="fitXY" />
このコードを使ってみました
ImageButton ib =(ImageButton)findviewbyId(R.id.elementImage);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(width, height);
ib.setLayoutParams(layoutParams);
ボタンのサイズは画像のサイズと同じままです。