padding

Padding not working on ImageButton

江枫思渺然 提交于 2019-11-30 01:13:28
In an app I am working on, I have several ImageButtons. Each ImageButton has a background and content in the form of a drawable. Right now the drawable is at maximum size within the confines of the ImageButton, but I want it to scale down so I need to add some padding. The thing is that when I try to do that, it doesn't have any effect. My XML is as follows for each ImageButton: <ImageButton android:id="@+id/button_zero" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:padding="10dip" android:src="@drawable/button_zero" android:background="

Android TextView drawable, change padding between drawable and text?

﹥>﹥吖頭↗ 提交于 2019-11-30 00:05:38
问题 I am creating a TextView with a drawable underneath, in a GridLayout . I want to bring the drawable to the middle of the TextView ; I tried with setCompoundDrawablePadding(-75) and it only changes the position of the text. Current code: TextView secondItem = new TextView(this); GridLayout.LayoutParams second = new GridLayout.LayoutParams(row2, col1); second.width = halfOfScreenWidth; second.height = (int) (quarterScreenWidth * 1.5); secondItem.setLayoutParams(second); secondItem

CSS-初学3

假如想象 提交于 2019-11-30 00:02:45
CSS三大特性 css层叠性 层叠性是指多种css样式的叠加。 是浏览器冲突的一个能力,如果一个属性通过两个相同选择器设置到同一个元素上,那么这个会将另一个属性层叠掉 一般情况下,如果出现样式冲突,则会按照css书写顺序,以最后的样式为准 样式冲突,遵循的原则是就近原则。那个样式离着结构近,就执行那个样式。 样式不冲突,不会层叠 css继承性 所谓继承性是指书写CSS样式表时,子标签会继承父标签的某些样式,如文本颜色和字号。想要设置一个可继承的属性,只需将它应用于父元素即可。 简单的理解就是:子承父业。 注意: 恰当地使用继承可以简化代码,降低CSS样式的复杂性。子元素可以继承父元素的样式(text-, font-,,1ine-这些元素开头的都可以继承,以及co1or属性) css优先级 定义CSS样式时,经常出现两个或更多规则应用在同一元素上,这时就会出现优先级的问题。 在考虑权重时,初学者还需要注意一些特殊的情况, 具体如下: 继承样式的权重为0。即在嵌套结构中,不管父元素样式的权重多大,被子元素继承时,他的权重都为0,也就是说子元素定义的样式会覆盖维承来的样式。 行内样式优先。应用sty1e属性的元素,其行内样式的权重非常高,可以理解为远大于100。总之,他拥有比上面提高的选择器都大的优先级。 权重相同时,CSS遵循就近原则。也就是说靠近元素的样式具有最大的优先级

How to remember in CSS that margin is outside the border, and padding inside

ε祈祈猫儿з 提交于 2019-11-29 23:52:26
I don't edit CSS very often, and almost every time I need to go and google the CSS box model to check whether padding is inside the border and margin outside, or vice versa. (Just checked again and padding is inside). Does anyone have a good way of remembering this? A little mnemonic, a good explanation as to why the names are that way round ... When working with CSS finally drives you mad the padded cell that they will put you in has the padding on the inside of the walls. pin - P is in You are using a box. If you were putting something in a box you would put some padding inside to make sure

How to set the padding for CardView widget in Android L

江枫思渺然 提交于 2019-11-29 23:28:57
I'm using android:paddingLeft and android:paddingTop to set the padding for the new CardView widget but it doesn't work. I can set the margin for all the controls inside the CardView as a workaround but that's a pain if there are too many controls. How to set padding for the new cardview widget? <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_gravity="center" android:layout_width="match_parent" android:layout_height="200dp" android:paddingLeft="20dp" android:paddingRight="@dimen/activity_horizontal_margin"

48/49 前端--CSS样式

不问归期 提交于 2019-11-29 22:16:03
目录 CSS样式 1. 高度宽度 2. 字体属性 文字字体 font-family 文字大小 font-size 文字字重(粗细) font-weight 字体颜色 3. 文本 文本对齐 text-align 文字装饰 text-decoration 首行缩进 text-indent 练习: 4. 背景图 background 练习: 5. 边框 border 属性: 练习: 6. display属性 练习: 7. 盒子模型 margin外边距 padding内边距 练习: 8. float 浮动 练习: 9. overflow 溢出属性 练习: 10. 定位 position z-index 层级 opacity 标签透明度 圆形头像 CSS样式 1. 高度宽度 width:200px; # 宽度。50% 按父级标签的宽度百分比来算 height:200px; # 高度 块级标签才能设置宽度,内联标签的宽度由内容来决定。 2. 字体属性 文字字体 font-family font-family可以把多个字体名称作为一个“回退”系统来保存。如果浏览器不支持第一个字体,则会尝试下一个。浏览器会使用它可识别的第一个值。 p { font-family: "Microsoft Yahei", "微软雅黑", "Arial", sans-serif } 文字大小 font-size

day20190916notes

折月煮酒 提交于 2019-11-29 22:07:51
记得学完知识,趁热打铁。认真看3遍,写抄写模仿3遍。记不得,就罚抄3遍。奖罚分明。自知之明。最重要的是看懂和理解代码。能自己看懂代码,多花时间和功夫。 只要功夫深,铁杵磨成针。确定一个努力的方向,坚持和努力。物理学。 默写: jQuery_Chapter03_20190916/ css / style.css * { padding : 0 ; margin : 0 ; } html { color : #404040 ; font-size : 12px ; font-family : "Arial" , "微软雅黑" ; } a { text-decoration : none ; color : #1a66b3 ; } ul { list-style : none ; } .left { float : left ; } .right { float : right ; } .hide { display : none ; } .clearfix { clear : both ; overflow : hidden ; height : 0 ; } .wrap { width : 1200px ; margin : 0 auto ; } /**头部**/ .top { height : 32px ; background : #f9f9f9 ; padding-top :

CSS实现圆角矩形

落爺英雄遲暮 提交于 2019-11-29 21:26:38
<div class="col-xs-4"> <div class="row"> <div class="panel" style="position:relative;border:0.02rem solid #052841;border-radius:0.08rem;background-color: rgba(255, 255, 255, 0.0);"> <span style="position:absolute;padding:0.06rem;border-style:solid;border-color: #005F79;border-width: 0.02rem 0 0 0.02rem;top:-0.02rem;left:-0.02rem;border-top-left-radius:0.08rem;"></span> <span style="position:absolute;padding:0.06rem;border-style:solid;border-color: #005F79;border-width: 0.02rem 0.02rem 0 0;top:-0.02rem;right:-0.02rem;border-top-right-radius:0.08rem;"></span> <span style="position:absolute

CSS: Is it correct that text content of a div overflows into the padding?

不羁的心 提交于 2019-11-29 20:18:26
I expected that the padding inside a div would remain clear of any text. But given the following html/css, the content-text spills out into the padding; <div class="foo">helloworld</div> .foo { float: left; overflow: hidden; background: red; padding-right: 10px; width: 50px; border: 1px solid green; } The text overflows it's 50px size and into the 10px padding. Is that by design? If so it seems pretty dumb - padding isn't padding if it's got stuff in it! Or am I just doing something wrong? Regards, CSS newbie. This is the correct behavior. overflow: hidden will clip content that extends

Malloc vs new — different padding

◇◆丶佛笑我妖孽 提交于 2019-11-29 20:13:17
I'm reviewing someone else's C++ code for our project that uses MPI for high-performance computing (10^5 - 10^6 cores). The code is intended to allow for communications between (potentially) different machines on different architectures. He's written a comment that says something along the lines of: We'd normally use new and delete , but here I'm using malloc and free . This is necessary because some compilers will pad the data differently when new is used, leading to errors in transferring data between different platforms. This doesn't happen with malloc . This does not fit with anything I