这个问题以前可能已经被问过了,但我似乎没有做太多progress
。在HorizontalScrollView里添加一个OnclickListener到ImageViews
基本上我想一个onclicklistener
添加到我的HorizontalScrollView
按下时将扩展image
。
这里是在XML
文件的当前代码:
<HorizontalScrollView
android:id="@+id/firstscrollview"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_gravity="left"
android:orientation="horizontal"
android:layout_marginTop="50dp">
<LinearLayout
android:id="@+id/firstlinear"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:orientation="horizontal" >
<ImageView
android:id="@+id/Cercie_button"
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleType="fitCenter"
android:src="@drawable/image"/>
我一直在尝试不同的东西,但我似乎无法得到它的工作,如果有人知道或能找到一个好例如它将非常感激!
添加它在onCreate方法在MainActivity – Juan
的备选解决方案将是一个'ImageButton'而不是图像视图。 'ImageButton'可以在layout.xml上实现onClick xml属性 – abcOfJavaAndCPP