Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ImageView PinchZoom多重布局_Android_Xml_Layout_Dynamic_Zooming - Fatal编程技术网

Android ImageView PinchZoom多重布局

Android ImageView PinchZoom多重布局,android,xml,layout,dynamic,zooming,Android,Xml,Layout,Dynamic,Zooming,只是停留在这里,我不知道如何在多个xml文件中显示。我有button1.xml、button2.xml和button3.xml。我希望能够在活动中动态切换这些视图 > <LinearLayout > xmlns:android="http://schemas.android.com/apk/res/android" > android:orientation="vertical" > android:layout_width="match_paren

只是停留在这里,我不知道如何在多个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" />
setVisibility()
应该可以解决您的问题。使用
view.setVisibility(view.VISIBLE)
view.setVisibility(view.GONE)
动态显示和隐藏活动布局中的视图。或者,如果您有多个xml文件,并且希望在同一活动中显示它们,那么只需再次使用适当的id调用
setContentView(id)

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