我怎样才能绑定复选框图像 [英] How can I bind checkboxes to an image

查看:110
本文介绍了我怎样才能绑定复选框图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要绑定复选框来的图像上的特定地点。这里是一个图像我怎么会喜欢它。

I want to bind checkboxes to a specific place on an image. Here is an image how I would like it.

http://i.stack.imgur.com/p00NO.png 红色的方块是复选框和黑色方块在那里,我想这个复选框。问题是,复选框的位置会发生变化的时候,屏幕不会改变。因此,他们不会停留在黑色方块。是否有机会做到这一点?

http://i.stack.imgur.com/p00NO.png The red squares are the checkboxes and the black squares are there where I want this checkboxes. The problem is that the position of the checkboxes will change when the screen gonna change. So they will not stay in the black squares. Is there any chance to do this?

泰提前。

推荐答案

试试这个:

<CheckBox android:layout_height="wrap_content" 
    android:id="@+id/checkBox1" 
    android:layout_width="wrap_content" 
    android:drawableRight="@drawable/icon" 
    android:text="" android:layout_x="58dip"  
    android:layout_y="106dip"></CheckBox>

如果你想要把你的复选框上的图像在中央底部,那么做这样的事情:

And if you want to put your checkbox on image at center-bottom then do something like this :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/relativeLayout1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/ic_launcher"
    android:gravity="center" >

    <CheckBox
        android:id="@+id/checkBox1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RelativeLayout>

通过夸大它使用上面的布局为您的每一个观点,并根据您的需要使用相对布局ID设置的图像。

Use the above layout for your each view by inflating it and set images according to your need by using relative layout id.

这篇关于我怎样才能绑定复选框图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆