只是卡在这里,我不知道如何在多个 xml 文件中显示。我有 button1.xml、button2.xml 和 button3.xml。我希望能够在活动中动态切换这些视图。
> <LinearLayout
> xmlns:android="http://schemas.android.com/apk/res/android"
> android:orientation="vertical"
> android:layout_width="match_parent"
> android:layout_height="match_parent" >
> <com.apps.example.TouchImageView
> android:id="@+id/snoop"
> android:layout_width="match_parent"
> android:src="@drawable/keutamaandua"
> android:layout_height="match_parent" />
文件
public class TouchImageViewActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.button1);
TouchImageView img = (TouchImageView) findViewById(R.id.snoop);
img.setImageResource(R.drawable.keutamaandua);
img.setMaxZoom(4f);