barriers / 阅读 / 详情

React Native 之组件详解

2023-07-14 14:25:53
共1条回复
阿啵呲嘚

引言

由于我忙于当前的项目,暂未更新,现在继续和大家一起去React Native门派学习,相信通过前几篇文章的介绍,我们对React Native门派有了一个大致了解,并且基本上搭建好了环境以及完成了新手村长的任务,写出了万门之祖的Hello world,那么接下来我们将逐一的了解,React Native中的每一个组件师兄,剖析他们的构成以及属性。咱们还是老套路直奔主题,上干货。

在学习各个组件之前,我们先学习一下Flexbox布局即这些组件如何排布布局的,如果你学过CSS布局,那么React Native中的Flexbox的工作原理与CSS基本一样的,没接触过也没关系,我们一起重头学习。

flexDirection可以决定布局的主轴的方向,即子元素是横着排布还是竖着排布,

justifyContent可以决定其子元素沿着主轴的排列方式,即对齐方式

alignItems可以决定其子元素沿着次轴的对齐方式

如果项目未设置高度或设为auto,将占满整个容器的高度(要使stretch选项生效的话,子元素在次轴方向上不能有固定的尺寸)

项目的第一行文字的基线对齐。

水平或垂直布局时:如果子View放不下,则自动换行, 默认为"nowrap"(不换行)

允许单个项目有与其他项目不一样的对齐方式,可覆盖align-items属性。默认值为auto,表示继承父元素的align-items属性,如果没有父元素,则等同于stretch。

权重,类似Android中weight

当flex取正整数值时是一个正数, 它使组件具有灵活性, 并且它的大小与其 flex 值成正比。因此, 将flex设置为2的组件将占用空间的两倍, 作为具有flex设置为1的组件。

当flex为0时, 该组件根据width和height进行调整, 并且不灵活。

当flex为-1 时, 组件通常根据width和height进行调整。但是, 如果没有足够的空间, 组件将收缩到其minWidth和minHeight.

flexGrow、flexShrink 和 flexBasis 的工作与 CSS 相同。

定位模式,分为absolute和relative两种

即绝对定位,相对于父组件的位置

相对定位,相对于当前位置

定位的元素及其子代的zIndex顺序。当元素重叠时, zIndex顺序决定哪一个覆盖另一个。具有较大z-index的元素通常覆盖具有较低的元素

margin是指从自身边框到另一个容器边框之间的距离,就是容器外距离。 padding是指自身边框到自身内部另一个容器边框之间的距离,就是容器内距离,下面这张是CSS的效果图,只是名字不一样(marginTop),原理都是一样;

除了图上那些属性还有如下属性

marginTop, marginLeft, marginBottom, marginRight

marginHorizontal: 水平外距离相当于marginLeft和marginRight

marginVertical:垂直外距离相当于marginTop和marginBottom

borderWidth,borderTopWidth,borderLeftWidth,borderBottomWidth,borderRightWidth

paddingTop,paddingBottom,paddingLef,paddingRight

paddingHorizontal: 水平内距离相当于paddingLeft和paddingRight

paddingVertical:垂直内距离相当于paddingTop和paddingBottom

指定在其块级容器的大小太大时, 是剪辑内容、显示滚动条还是显示溢出的内容.

相关推荐

css代码“margin-bottom:5px”是什么意思?

照理这是一个无效属性。经测试,也就只有Ie8依然能识别,所以可以说这个是Ie8的一个Css hack.。显示效果为:Margin-bottom:5Px,其它浏览器会忽略这个属性。层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。CSS不仅可以静态地修饰网页,还可以配合各种脚本语言动态地对网页各元素进行格式化。CSS 能够对网页中元素位置的排版进行像素级精确控制,支持几乎所有的字体字号样式,拥有对网页对象和模型样式编辑的能力。
2023-07-14 06:18:271

微信小程序margin-bottom在iOS上失效的解决方式

给最外层page加上padding-bottom:1rpx;
2023-07-14 06:18:341

367, 关于relativeLayout的margin_bottom 设置无效的问题

RelativeLayout布局里 1、当设置为android:layout_height="wrap_content"时,最下面的控件layout_marginBottom属性无效,如果其他控件使用layout_above让自己处于最下面的控件之上,那么layout_marginBottom属性有效。 2、当设置为android:layout_height="match_parent"时,或者高度为固定值,那么最下面的控件layout_marginBottom属性才会有效。
2023-07-14 06:18:411

在CSS中,margin:10px auto; margin-bottom:35px;这两句写在一起,表示什么意思?分别是哪个方面的距离?

求卡通天地课件芒果tv缓冲完了为什么还是不能播放急,求高人就是那种缓冲到00%了,下载速度也还可以,但就是不能播放,与正在缓冲时一样。而且卸了重新下载也没用,还是这样
2023-07-14 06:18:516

CCS里,margin-bottom无效是什么情况?

设置为margin-bottom:0;
2023-07-14 06:19:084

css margin-bottom失效是什么原因?

<html><head><style>/*body*/#container {width:900px;margin:0 auto;}/*header*/#header {height:70px;width:900px; background:#CCFFCC; margin-bottom:8px;}#nav {height:30px;width:900px; background:#CCFFCC; margin-bottom: 8px;}/*main*/#maincontent {margin-bottom:8px;width:900px; height:500px;}#main{float:left; width:664px; height:500px; background: #FFFF99;}#side {float:right; width:230px; height:500px; background:#FFCC99;}/*footer*/#footer {height:70px; background:#CCFFCC;}.clearfloat {clear:both;height:0;font-size: 1px;line-height: 0px;}</style><head><body>div代码:<div id="container"><div id="header">此处显示id"header"的内容</div><div class="clearfloat"></div><div id="nav">此处显示id"nav"的内容</div><div class="clearfloat"></div><div id="maincontent"><div id="main">此处显示id“main”的内容</div><div id="side">此处显示id“side”的内容</div></div><div class="clearfloat"></div><div id="footer">此处显示id“footer”的内容</div></div></body></html>
2023-07-14 06:19:151

margin-bottom:不起作用,怎么办呀,急!!

你这里的margin-bottom是说相对于你的<p>标签下面的一个内容的距离,所以这里就没表现出来
2023-07-14 06:19:244

#header { margin-bottom: 8px; min-width: {WRAPWIDTH}; 中“margin-bottom: 8px; ”什么意思?

设定下边缘宽度 margin-bottom 设定下边缘宽度;另外有margin-right  设定右边缘宽度;margin-left 设定左边缘宽度。这个词是网页编辑里的使用词……
2023-07-14 06:19:313

css代码margin-bottom:5px 是什么意思???

照理这是一个无效属性,经测试,也就只有Ie8依然能识别,所以可以说这个是Ie8的一个Css hack. 显示效果为:Margin-bottom:5Px;其它浏览器会忽略这个属性。
2023-07-14 06:19:402

android marginbutton问题

错,marginBottom是控件本身与下方控件的距离这里的bottom指的是本身的下方
2023-07-14 06:20:013

css代码问题 margin-bottom:0px 在火狐中没效果,

margin-top: 0px !important;
2023-07-14 06:20:093

android:layout_below="@id/rl_userinfo" android:layout_marginBottom="@dimen/margin_superlarge" 啥意思

楼上正解
2023-07-14 06:20:303

css中 *margin-bottom:20px!important;解释下这里的*及!important的作用

一楼回答得太好了。。专业的??
2023-07-14 06:20:404

如何用js控制margin-bottom属性

this.style.marginBottom
2023-07-14 06:20:492

在eclipse中android:layout_marginBottom="30dip"表示什么意思?

表示该属性所属的控件下侧内边距为30个设备独立像素
2023-07-14 06:20:582

为什么margin-bottom设置后没效果,急!

。。。。margin-bottom:0px 那是废代码好不好如果你是做一条线的话加上下面代码:clear:both;overflow:inherit;height:2px;高度自己定
2023-07-14 06:21:161

为什么div的高自动了后在加margin-bottom:10px;就不管用了啊,帮忙解决一下

因为不能确定div的高度,有两种解决方法:1设置padding-top:10px;2设置div下面的一个元素的margin-top:10px;
2023-07-14 06:21:241

android alignparentbottom之后margin就没用了吗

楼主现在是有一个LinearLayout的布局,但是想在底端加上一个view. 可是在LinearLayout中设置了,layout_marginBottom="0dip";android:layout_gravity="bottom"不起作用是吧? 如果我的上述理解没错的话,楼主可以最外层用RelativeLayout, RelativeLayout中包含以前的LinearLayout, 底端view要加上android:layout_alignParentBottom="true", 这样设置就没有问题了。
2023-07-14 06:21:321

网页设计如何设置网页部分内容不随着滚动条而移动移动?

这个主要从两方面来着手:CSS部分:写一个样式,使用position:fixed(基于浏览器边框的绝对定位)JS部分:获取当前页面高度,然后绑定滚动条移动事件,检测当页面滚动一半位置时,为右边部分的容器加上第一步中写好的样式。
2023-07-14 06:21:482

android:gravity=center 表示文字居中,android:gravity=bottom是显示底部。我想要底部又居中怎么搞?

center_vertical是垂直居中,你设置水平居中啊bottom|center_horizontal当然也可以控制与底部的距离:android:layout_marginBottom="20dp"
2023-07-14 06:21:551

为什么我在li在设置了margin-bottom:10px;在IE7,IE8都现实不出来?在IE6却能正常现实

div有浮动吗?如果有浮动要清楚浮动。贴个代码出来,帮你看看
2023-07-14 06:22:132

android studio约束布局 如何制作阵列

ConstraintLayout(约束布局), 是2016年Google I/O最新推出的Android布局, 目前还在完善阶段. 从推出的力度而言, 应该会成为主流布局样式. 在最新版本的Android Studio中, ConstraintLayout已经成为默认布局.
2023-07-14 06:22:241

关于Android开发的背景图片置底层的问题

从上面看你用的是相对布局 你动了ImageView 是不是这个也需要调整一下:android:layout_alignTop="@+id/imageView1"
2023-07-14 06:23:001

网页设计如何设置网页部分内容不随着滚动条而移动移动

js 固定div层
2023-07-14 06:23:096

{margin-bottom:0;}是什么意思?

底边外边距设置为0
2023-07-14 06:23:511

css中 *margin-bottom:20px!important;解释下这里的*及!important的作用

*是区分浏览器兼容性的,写在一条样式里可以区分IE6、IE7和别的浏览器的不同,如:.bor{border:20pxsolidgreen;*border:20pxsolidred;padding:30px;width:300px;}绿色边框的样式写在前面,这时候所有浏览器都是绿色边框,红色边框的样式用了*,IE6和IE7能识别,其他浏览器不能识别,所以覆盖了前面的绿色边框,所以IE6和IE7显示红色边框,其他浏览器显示绿色边框!important的作用是提高指定样式规则的应用优先权。写在定义的最后面,例如:box{color:red!important;}最重要的一点是:IE6.0一直都不支持这个语法,而其他的浏览器都支持。因此我们就可以利用这一点来分别比如:.bor{border:20pxsolidred!important;border:20pxsolidgreen;padding:30px;width:300px;}因为ie6不认识!important,后面的绿色边框样式就会覆盖前面那句红色边框样式,而如ie7、火狐等浏览器认识!important,知道这一条样式的优先级要比后面那句高,就只会执行这句红色边框的样式。
2023-07-14 06:24:031

style="margin-bottom:-5是什么意思?

距离下边距-5像素
2023-07-14 06:24:191

为什么在relativelayout 底部还是有距离

问题太模糊了,没语境。正常情况下是没有距离的,可以看看你的layout_height的值,还有padding,paddingBottom,margin,marginBottom是否设置了值
2023-07-14 06:24:272

css中 top:或bottom等 还有margin属性为负数是什么意思啊?

为负数就是向反方向移动。比如<div style="margin-right:5px;"></div><div></div>这两个div中间应该空5px,因为左边的div在右边留有5px的边距。如果改成<div style="margin-right:-3px;"></div><div></div>意思就是这两个div不仅中间没空,而且还有3px的部分是重叠在一起的。自己写几个div试验下就知道了。
2023-07-14 06:24:351

Android为什么设置params.bottomMargin无效?

你可以把你这个 直接放xml里试下 如果同样无效 那就不是你java代码里的问题啊xml里写layout_marginBottom就经常和我们期望的不一样 因为这句代码起作用时 你下面的控件还没生成 这个BOTTOM就会成为 整个布局的最底端。。
2023-07-14 06:24:442

在table里这个属性的写法对吗?style=" margin-bottom:20px;"

OK啊!不过;不用写在“”裏面 style=" margin-bottom:20px"
2023-07-14 06:25:031

CSS DIV间隔浏览器底部100PX

ie6奇葩浏览器会否定你的楼上两个说的都 不对不用试了
2023-07-14 06:25:124

Android开发里遇到键盘出现时ScrollView不能滚动,怎么解决

  在用ScrollView包裹TextView时发现。滚动条有时候滚动不到最底端,原因是在TextView中设置了android:layout_marginTop="20dp",导致marginTop之后,scrollView初始显示的位置向下移动了20dp,你如果想要让他正常显示,必须在代码里面设置一下scrollView的初始显示位置就可以了。mScrollView.smoothScrollTo(0,0).  当然可以去掉TextView的marginTop,在它上面的组件设置layout_marginBottom也是OK的,这样ScrollView中的内容就可以完全显示了!
2023-07-14 06:25:282

android TextView滚动条设置android:ellipsize="marquee" android:scrollbars="horizontal" android:marqu

在你的xml文件中加下面三行就行了。android:focusable="true"android:focusableInTouchMode="true"android:single="true"顺便说一下你的字数要超过你textview的宽度。
2023-07-14 06:25:353

css中margin和padding区别以及用途是什么?刚学css被这两个东西困扰了很久

磕氖加工厂谒
2023-07-14 06:26:031

如何用jQuery实现头部或者底部固定工具栏,就好像百度知道底部的工具栏一样!

搜狗啊啊
2023-07-14 06:26:172

Android的LinearLayout布局能不能调整内部控件的间距

这个时候你使用Button的margin属性就可以解决了。
2023-07-14 06:26:498

网页设计如何设置网页部分内容不随着滚动条而移动移动?

div的样式中使用相当于浏览器窗口定位——position:fixed。x0dx0a一、position:fixed属性的含义x0dx0afixed:生成绝对定位的元素,相对于浏览器窗口进行定位。元素的位置通过 "left", "top", "right" 以及 "bottom" 属性进行规定。x0dx0a我们平时所说的固定定位指的就是fixed,设置了固定定位的元素不会随滚动条上下滚动。x0dx0ax0dx0a二、一般的 position:fixed; 实现方法x0dx0a#top{position:fixed;bottom:0;right:20px}x0dx0a实现了id为top的元素固定在浏览器的底部和距离右边20个像素的位置x0dx0a#top{position:fixed;top:20px;right:20px}x0dx0a实现了id为top的元素固定在距离浏览器的顶部20个像素和距离右边20个像素的位置x0dx0ax0dx0a三、IE6下position:fixed; 实现方法x0dx0a在IE6中是不能直接使用 position:fixed; 。你需要一些 CSS Hack 来解决它x0dx0a相同的还是让 ... 元素固定在浏览器的底部和距离右边的20个像素,这次的代码是:#top{x0dx0aposition:fixed;x0dx0abottom:0;x0dx0aright:20px;x0dx0a_position:absolute;x0dx0ax0dx0a_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));x0dx0a}x0dx0aright 跟 left 属性可以用绝对定位的办法解决,而 top 跟 bottom 就需要用上面的表达式来实现。其中在_position:absolute; 中的 _ 符号只有 IE6 才能识别,目的是为了区分其他浏览器x0dx0ax0dx0a1、使元素固定在浏览器窗口的顶部:x0dx0a#top{x0dx0a_position:absolute;x0dx0a_top:expression(eval(document.documentElement.scrollTop));x0dx0a}x0dx0a2、使元素固定距浏览器窗口的顶部a像素的位置:x0dx0a#top{x0dx0a_position:absolute;x0dx0a_top:expression(eval(document.documentElement.scrollTop));x0dx0a_margin-top:a;x0dx0a}或者x0dx0a#top{x0dx0a_position:absolute;x0dx0a_top:expression(eval(document.documentElement.scrollTop+a));x0dx0a}x0dx0a3、使元素固定在浏览器窗口的底部:x0dx0a#top{x0dx0a_position:absolute;x0dx0a_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));x0dx0a}x0dx0a4、使元素固定在距浏览器窗口的底部b像素的位置:x0dx0a#top{x0dx0a_position:absolute;x0dx0a_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));x0dx0a_margin-bottom:b;x0dx0a}或者x0dx0a#top{x0dx0a_position:absolute;x0dx0a_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||b)-(parseInt(this.currentStyle.marginBottom,10)||b)));x0dx0a}x0dx0a四、IE6下的闪动问题x0dx0a问题还没有完全解决。在用了上面的办法后,你会发现:被固定定位的元素在滚动滚动条的时候会闪动。解决闪动问题的办法是在 CSS 文件中加入:x0dx0a*html{background-image:url(about:blank);background-attachment:fixed;}x0dx0a其中 * html选择器hack是给 IE6 识别的。x0dx0a到此,IE6 的 position:fixed; 问题已经被解决了
2023-07-14 06:27:061

如何DIV固定在底部,页面滚动也一样在底部不变,并且拉滚动条的时候没有变动的过程

position:fixed,然后加top/bottom,left/right值试试
2023-07-14 06:27:344

Android 界面中Button中文字不居中,怎么回事?

android :gravity="center_horizontal"改为android :gravity="center_horizontal | center_vertical"
2023-07-14 06:27:441

pycharm中设置margin0auto无用?

在 PyCharm 中设置 margin0auto 用于表格单元格排版,可以使得单元格之间没有边框,并且单元格内容自动换行。但如果单元格内容太长,导致无法全部显示,则可能会出现重叠或溢出的情况。为了解决这个问题,可以在单元格中添加一个 max-width 属性,指定单元格的最大宽度,以避免内容溢出。例如,以下代码会将单元格内容限制在 500 像素宽度内:Copy code.table-cell {display: table-cell;margin: 0 auto;max-width: 500px; }请注意,如果单元格内容无法完全显示,则可能会出现重叠或溢出的情况。因此,如果您希望单元格内容尽可能地显示完整,请不要使用 margin0auto 和 max-width 属性。而是使用其他布局方式,例如 margin-bottom 属性来确保单元格下方的内容完全显示。
2023-07-14 06:27:501

div紧贴在网站内容的左或者右边,上下自由浮动,不受屏幕分辨率控制,如何实现

去网上搜javascript代码可以实现
2023-07-14 06:28:014

怎么实现div层随着浏览器滚动条而滚动(绝对定位的层)?

#info{background:#000;color:#fff;bottom:0;margin:0auto;position:fixed;height:23px;/*opacity:.85;filter:alpha(opacity=85);*/line-height:23px;width:100%;z-index:999;_bottom:auto;_width:100%;_position:absolute;_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));}这是一个兼容IE6的绝对定位的写法。始终处于浏览器底部。
2023-07-14 06:28:071

highcharts 怎样动态为series的name,data赋值

$(function () {var chart = $("#container").highcharts({chart: {marginBottom: 80},xAxis: {categories: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]},yAxis: {labels: {align: "left",x: 0,y: -2}},series: [{data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]}]}).highcharts();setTimeout(function(){chart.series[0].setData([]); // 更新 series},1000);});
2023-07-14 06:28:231

安卓padding和margin的区别

控件之间的间距有两种设置:android:layout_margin="10dp" 外边距android:padding="10dp" 内边距Android中 padding和margin的简单地理解:margin为外边距,padding为内边距。1.padding的常用属性:android:paddingTopandroid:paddingBottomandroid:paddingLeftandroid:paddingRight2.margin的常用属性:android:layout_marginTopandroid:layout_marginBottomandroid:layout_marginLeftandroid:layout_marginRight
2023-07-14 06:28:411

floatingactionbutton怎么弹出多个同样的按钮?android的

下面是demo的代码(主要见sample):布局:?<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:fab="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background" > <com.getbase.floatingactionbutton.FloatingActionButton android:id="@+id/pink_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="dp" fab:fab_colorNormal="@color/pink" fab:fab_colorPressed="@color/pink_pressed" fab:fab_icon="@drawable/ic_fab_star" /> <TextView style="@style/menu_labels_style" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/pink_icon" android:layout_centerHorizontal="true" android:layout_marginBottom="dp" android:text="Text below button" /> <com.getbase.floatingactionbutton.AddFloatingActionButton android:id="@+id/semi_transparent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/pink_icon" android:layout_centerHorizontal="true" android:layout_marginBottom="dp" fab:fab_colorNormal="@color/blue_semi_transparent" fab:fab_colorPressed="@color/blue_semi_transparent_pressed" fab:fab_plusIconColor="@color/white" /> <com.getbase.floatingactionbutton.FloatingActionButton android:id="@+id/setter" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/semi_transparent" android:layout_centerHorizontal="true" android:layout_marginBottom="dp" /> <com.getbase.floatingactionbutton.AddFloatingActionButton android:id="@+id/normal_plus" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginBottom="dp" android:layout_marginLeft="dp" android:layout_marginStart="dp" fab:fab_colorNormal="@color/white" fab:fab_colorPressed="@color/white_pressed" fab:fab_plusIconColor="@color/half_black" /> <com.getbase.floatingactionbutton.FloatingActionsMenu android:id="@+id/right_labels" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/normal_plus" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginLeft="dp" android:layout_marginStart="dp" fab:fab_addButtonColorNormal="@color/white" fab:fab_addButtonColorPressed="@color/white_pressed" fab:fab_addButtonPlusIconColor="@color/half_black" fab:fab_addButtonSize="mini" fab:fab_labelStyle="@style/menu_labels_style" fab:fab_labelsPosition="right" > <com.getbase.floatingactionbutton.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" fab:fab_colorNormal="@color/white" fab:fab_colorPressed="@color/white_pressed" fab:fab_title="Label on the right" /> <com.getbase.floatingactionbutton.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" fab:fab_colorNormal="@color/white" fab:fab_colorPressed="@color/white_pressed" fab:fab_size="mini" fab:fab_title="Another one on the right" /> </com.getbase.floatingactionbutton.FloatingActionsMenu> <com.getbase.floatingactionbutton.FloatingActionsMenu android:id="@+id/multiple_actions" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_marginBottom="dp" android:layout_marginEnd="dp" android:layout_marginRight="dp" fab:fab_addButtonColorNormal="@color/white" fab:fab_addButtonColorPressed="@color/white_pressed" fab:fab_addButtonPlusIconColor="@color/half_black" fab:fab_labelStyle="@style/menu_labels_style" > <com.getbase.floatingactionbutton.FloatingActionButton android:id="@+id/action_a" android:layout_width="wrap_content" android:layout_height="wrap_content" fab:fab_colorNormal="@color/white" fab:fab_colorPressed="@color/white_pressed" fab:fab_title="Action A" /> <com.getbase.floatingactionbutton.FloatingActionButton android:id="@+id/action_b" android:layout_width="wrap_content" android:layout_height="wrap_content" fab:fab_colorNormal="@color/white" fab:fab_colorPressed="@color/white_pressed" fab:fab_title="Action with a very long name that won"t fit on the screen" /> </com.getbase.floatingactionbutton.FloatingActionsMenu> <com.getbase.floatingactionbutton.FloatingActionsMenu android:id="@+id/multiple_actions_down" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginEnd="dp" android:layout_marginRight="dp" android:layout_marginTop="dp" fab:fab_addButtonColorNormal="@color/white" fab:fab_addButtonColorPressed="@color/white_pressed" fab:fab_addButtonPlusIconColor="@color/half_black" fab:fab_addButtonSize="mini" fab:fab_expandDirection="down" fab:fab_labelStyle="@style/menu_labels_style" > <com.getbase.floatingactionbutton.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" fab:fab_colorNormal="@color/white" fab:fab_colorPressed="@color/white_pressed" fab:fab_size="mini" /> <com.getbase.floatingactionbutton.FloatingActionButton android:id="@+id/button_remove" android:layout_width="wrap_content" android:layout_height="wrap_content" fab:fab_colorNormal="@color/white" fab:fab_colorPressed="@color/white_pressed" fab:fab_title="Click to remove" /> <com.getbase.floatingactionbutton.FloatingActionButton android:id="@+id/button_gone" android:layout_width="wrap_content" android:layout_height="wrap_content" fab:fab_colorNormal="@color/white" fab:fab_colorPressed="@color/white_pressed" /> <com.getbase.floatingactionbutton.FloatingActionButton android:id="@+id/action_enable" android:layout_width="wrap_content" android:layout_height="wrap_content" fab:fab_colorNormal="@color/white" fab:fab_colorPressed="@color/white_pressed" fab:fab_title="Set bottom menu enabled/disabled" /> </com.getbase.floatingactionbutton.FloatingActionsMenu> <com.getbase.floatingactionbutton.FloatingActionsMenu android:id="@+id/multiple_actions_left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginEnd="dp" android:layout_marginRight="dp" android:layout_marginTop="dp" android:layout_toLeftOf="@+id/multiple_actions_down" android:layout_toStartOf="@+id/multiple_actions_down" fab:fab_addButtonColorNormal="@color/white" fab:fab_addButtonColorPressed="@color/white_pressed" fab:fab_addButtonPlusIconColor="@color/half_black" fab:fab_addButtonSize="mini" fab:fab_addButtonStrokeVisible="false" fab:fab_expandDirection="left" > <com.getbase.floatingactionbutton.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" fab:fab_colorNormal="@color/white" fab:fab_colorPressed="@color/white_pressed" /> <com.getbase.floatingactionbutton.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" fab:fab_colorNormal="@color/white" fab:fab_colorPressed="@color/white_pressed" fab:fab_size="mini" /> <com.getbase.floatingactionbutton.FloatingActionButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:visibility="gone" fab:fab_colorNormal="@color/white" fab:fab_colorPressed="@color/white_pressed" fab:fab_size="mini" /> </com.getbase.floatingactionbutton.FloatingActionsMenu> <com.getbase.floatingactionbutton.FloatingActionButton android:id="@+id/setter_drawable" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/setter" android:layout_centerHorizontal="true" /> </RelativeLayout> JAVA代码: package com.getbase.floatingactionbutton.sample; import com.getbase.floatingactionbutton.FloatingActionButton; import com.getbase.floatingactionbutton.FloatingActionsMenu; import android.app.Activity; import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.shapes.OvalShape; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.pink_icon).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this, "Clicked pink Floating Action Button", Toast.LENGTH_SHORT).show(); } }); FloatingActionButton button = (FloatingActionButton) findViewById(R.id.setter); button.setSize(FloatingActionButton.SIZE_MINI); button.setColorNormalResId(R.color.pink); button.setColorPressedResId(R.color.pink_pressed); button.setIcon(R.drawable.ic_fab_star); button.setStrokeVisible(false); final View actionB = findViewById(R.id.action_b); FloatingActionButton actionC = new FloatingActionButton(getBaseContext()); actionC.setTitle("Hide/Show Action above"); actionC.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { actionB.setVisibility(actionB.getVisibility() == View.GONE ? View.VISIBLE : View.GONE); } }); final FloatingActionsMenu menuMultipleActions = (FloatingActionsMenu) findViewById(R.id.multiple_actions); menuMultipleActions.addButton(actionC); final FloatingActionButton removeAction = (FloatingActionButton) findViewById(R.id.button_remove); removeAction.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ((FloatingActionsMenu) findViewById(R.id.multiple_actions_down)).removeButton(removeAction); } }); ShapeDrawable drawable = new ShapeDrawable(new OvalShape()); drawable.getPaint().setColor(getResources().getColor(R.color.white)); ((FloatingActionButton) findViewById(R.id.setter_drawable)).setIconDrawable(drawable); final FloatingActionButton actionA = (FloatingActionButton) findViewById(R.id.action_a); actionA.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { actionA.setTitle("Action A clicked"); } }); // Test that FAMs containing FABs with visibility GONE do not cause crashes findViewById(R.id.button_gone).setVisibility(View.GONE); final FloatingActionButton actionEnable = (FloatingActionButton) findViewById(R.id.action_enable); actionEnable.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { menuMultipleActions.setEnabled(!menuMultipleActions.isEnabled()); } }); FloatingActionsMenu rightLabels = (FloatingActionsMenu) findViewById(R.id.right_labels); FloatingActionButton addedOnce = new FloatingActionButton(this); addedOnce.setTitle("Added once"); rightLabels.addButton(addedOnce); FloatingActionButton addedTwice = new FloatingActionButton(this); addedTwice.setTitle("Added twice"); rightLabels.addButton(addedTwice); rightLabels.removeButton(addedTwice); rightLabels.addButton(addedTwice); } }
2023-07-14 06:28:501

android 怎么实现左侧导航栏

请看http://zhidao.baidu.com/question/1796025737303379747.html?fr=qlquick
2023-07-14 06:29:092

react函数式组件中使用lodash的debounce

import _ from "lodash" <Input style={{ marginBottom: 16 }} maxLength={25} onChange={userChange} /> const userChange = (e: any) => { callAjax(e.target.value) } const getMember = (value: any) => { fetchMember(value); // 最终的获取ajax数据的方法 } const callAjax = _.debounce(getMember, 300)
2023-07-14 06:29:281

Dreamweaver里的行间距怎么调?

加载CSS来控制
2023-07-14 06:29:3610

android GridView里一个Item有2个ImageView,怎么让这两个间隔为0

<LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical">外面换这个试试 把android:layout_alignLeft="@id/shujiaitem_image1"android:layout_below="@id/shujiaitem_image1"这些都去掉 如果还不行 我就要怀疑你的图片或者代码有问题了
2023-07-14 06:29:581