【问题标题】:Move imageview from scrollview to relativelayout将图像视图从滚动视图移动到相对布局
【发布时间】:2012-03-09 17:52:59
【问题描述】:

如何使用 dragndrop(或其他)将图像视图从 ScrollView 移动到 RelativeLayout? 安卓 2.2/2.3.3+ 我需要 OnTouch 获取 imageview 并平滑移动到 relativeLayout... 对不起我的英语..

【问题讨论】:

    标签: android imageview scrollview android-relativelayout


    【解决方案1】:

    我不确定这是不是你想要的,但你可以简单地转到 XML(没有拖放的图形布局),剪切 ImagaView 代码并将其放在 ScrollView 布局之外,

    请记住 ScrollView 只能作为一个对象的父对象,因此您可以在图像周围创建一个 LinearLayout

    从这里

    <ScrollView 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_alignParentTop="true"
            android:layout_above="@id/adView1">  
    
    
        <RelativeLayout
            android:id="@+id/relativeLayout2"
            android:layout_width="fill_parent"
            android:layout_height="352dp" >
    
        <ImageButton
            android:id="@+id/imageButton1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/buttongod" />
    
    </RelativeLayout>
    
    </ScrollView>
    

    到这里

    <ScrollView 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_alignParentTop="true"
            android:layout_above="@id/adView1"  
    
    
        <RelativeLayout
            android:id="@+id/relativeLayout2"
            android:layout_width="fill_parent"
            android:layout_height="352dp" >
    
    
    </RelativeLayout>
    
    <LinearLayout
    android:layout_width="wrap_content"
            android:layout_height="wrap_content"
    
    
    <ImageButton
            android:id="@+id/imageButton1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/buttongod" />
    
    </LinearLayout>
    
    </ScrollView>
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多