作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想创建一个左侧有图像的 android 按钮。目前我知道在按钮内设置图像的唯一方法是使用 android:background 属性并将其设置为图像,但这样做会拉伸(stretch)图像。我想避免拉伸(stretch)图像并确保它在按钮左侧保持正常大小。
我将如何修改以下代码来实现我的目标?
<ImageButton android:id="@+id/buttonBack"
android:layout_width="80dp"
android:layout_height="30dp"
android:focusable="true"
android:background="@drawable/buttonBack">
最佳答案
这样试试
<!-- For Image to the left of the text use android:drawableLeft tag -->
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/menu"
android:drawableLeft="@drawable/down_arrow"
android:drawablePadding="5dp"
android:text="@string/leftimage" />
<!-- For Image to the Right of the text use android:drawableRight tag -->
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/menu"
android:drawablePadding="5dp"
android:drawableRight="@drawable/down_arrow"
android:text="@string/righttimage" />
</LinearLayout>
关于android - 在按钮的左侧特别设置图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19277603/
我已经可以在其中输入一些附加文本了mydomain/wiki/Special:UserLogin。我添加了一句话: In order to apply for an account send an m
有人可以解释以下脚本输出背后的逻辑吗? import numpy if(numpy.dtype(numpy.float64) == None): print "Surprise!!!!" 谢谢
是我还是 gmail bulls**t?在 outlook/浏览器上,我的电子邮件是完美的,但在 gmail 上,2 个表之间有一个空间,为什么?!?图片:http://i.imgur.com/srJ
我是一名优秀的程序员,十分优秀!