如何把图像和复选框安装在同一行中像这样的iamge 可以使用图像查看这个吗? 谢谢。如何把图像放在android ..的复选框前面?
3
A
回答
1
使用线性布局的每一行,并把所有的人都在此也使用android:layout_toRightOf
为每个插件像复选框,TextView的这样使用
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/layout1">
<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/im1"/>
<CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ck1" android:layout_toRightOf="@+id/im1"/>
<TextView android:text="hi" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txt1" android:layout_toRightOf="@+id/ck1"/>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/layout2" android:layout_below="@id/layout1">
<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/im2"/>
<CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ck1" android:layout_toRightOf="@+id/im2"/>
<TextView android:text="hello" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/txt1" android:layout_toRightOf="@+id/ck2"/>
</LinearLayout>
</RelativeLayout>
3
这是很简单的。
使用相对布局(非常重要)。将你的图像放在你想要的位置(你可以将它与父级布局对齐),然后使用xml中的'右边'选项来对齐图片旁边的复选框。
关键要素是使用相对布局,并在您使用的xml中使用'在图片ID'右边。
您可以使用本教程。
http://mobile.tutsplus.com/tutorials/android/android-user-interface-design-relative-layouts/
2
如果前面你真正的意思是向右(或左),我认为最简单,最有效的方法是使用android:drawableRight
(或android:drawableLeft
)属性如
android:drawableRight="@drawable/my_img"
<CheckBox
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/my_checkBox1"
android:drawableRight="@drawable/my_img"
android:text="Option_Text">
</Checkbox>
这是有效的,因为它使用相同的视图。
+0
这可能是最优雅的方式,但它似乎不适用于JB。图像与复选框重叠,未放置在正确的位置。任何想法如何在JB上? – Muzikant
3
确定
然后把imageview
左侧,把复选框右侧 如果您想进行动态再一个选项也有,但它是不干不同。像
<CheckBox android:layout_height="wrap_content"
android:id="@+id/checkBox1" android:layout_width="wrap_content"
android:drawableRight="@drawable/icon" android:text="CheckBox" android:layout_x="58dip" android:layout_y="106dip"></CheckBox>
相关问题
- 1. 缩放复选框内的图像android
- 2. 把图像放在上面
- 3. 如何把复选框放在导航抽屉中android
- 4. 如何把背景图像放在logo图像后面?
- 5. vaadin如何选择性地把复选框放在treetable
- 6. 如何把值复选框
- 7. 如何把复选框放在listview的每一行中?
- 8. 如何把图像放在JButton上?
- 9. 如何把图像放在中心上方的另一个图像在android中?
- 10. 如何把图像放在html页面的中心?
- 11. 如何把视图放在导航栏后面的android?
- 12. 如何把图像放在图像旁边
- 13. 如何把图像放在图像视图
- 14. 把复选框放在组合框内的javascript
- 15. 如何把复选框运行时间在android
- 16. 把一个TextView放在ImageView的前面
- 17. 把UIView放在UITableView前面的UITableVewController
- 18. Android - 如何做图像的选取框
- 19. 自定义复选框图像android
- 20. 如何把复选框中点击列前
- 21. 拖放(如果我拖动右侧图像,则选中复选框)android
- 22. 如何把复选框禁用?
- 23. 如何使图像复选框
- 24. 如何创建复选框图像库
- 25. 如何把图像放入目录imagejpeg()?
- 26. 如何把图像放到Jbutton上
- 27. 如何在复选框中放置一个复选框?
- 28. 如何把文字放在图像上方(上图)?
- 29. 干净地将复选框放在缩略图图像中
- 30. 把一个imageView放在另一个Android的前面
这是一个很好的问题,我想知道复选框的这个数字是动态还是静态? –
是文字后显示图像吗? –
复选框是静态的。 – Miuranga