我尝试在android XML中的图像中放置常规按钮。如何做呢?我想是这样的:图像中的嵌套按钮
<ImageView .......
<Button .... />
</ImageView>
其中圆点代表代码。显然这不是因为平台抛出异常。
任何人都可以帮忙吗?
我尝试在android XML中的图像中放置常规按钮。如何做呢?我想是这样的:图像中的嵌套按钮
<ImageView .......
<Button .... />
</ImageView>
其中圆点代表代码。显然这不是因为平台抛出异常。
任何人都可以帮忙吗?
使用相对布局在图像上插入按钮。
您的图片应该在RelativeLayout的背景标签中给出。
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="@drawable/list_nav"
>
<Button
android:layout_width="63dp"
android:layout_height="36dp"
android:id="@+id/mapbutton"
android:layout_marginTop="7dp"
android:layout_marginLeft="4dp"
android:layout_alignParentLeft="true"
/>
此示例将在图像的左侧,因为我用layout_alignParentLeft =“真”
@Uriel弗兰克尔您可以尝试创建一个自定义的ImageView either.Here是关于Creating Custom ImageView后按钮。
希望它有帮助。
可以使用的FrameLayout:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView android:id="@+id/myImage"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:src="@drawable/icon" />
<Button android:id="@+id/myButton"
android:layout_width="150dip"
android:layout_height="150dip"
android:text="My Button"/>
</FrameLayout>
你不写,为什么你需要的图像和按钮。你知道ImageButton吗?
非常感谢!我用这个,它的工作原理! –