如何实现以下布局.没有添加按钮,我可以实现.但是,当向上滚动时,如何添加ADD按钮和添加按钮应该随着图像的视差而消失.
我发现浮动动作按钮没有添加文本的功能.我只能使用按钮.
没有添加按钮的我的xml布局:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layoutplace1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="150dip"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginBottom="20dp"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/framelayout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="bottom"
app:layout_anchor="@+id/appBarLayout"
app:layout_anchorGravity="bottom"
app:layout_collapseMode="none">
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:gravity="bottom"
android:textAllCaps="false"
android:theme="@style/MyCustomTabLayout"
app:tabGravity="center"
app:tabIndicatorColor="#574ec1"
app:tabIndicatorHeight="2dp"
app:tabMode="scrollable"
app:tabSelectedTextColor="#574ec1"
app:tabTextColor="#8A000000" />
</FrameLayout>
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:paddingBottom="56dp"
android:layout_marginTop="50dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigation_viewplace1"
android:layout_height="match_parent" …Run Code Online (Sandbox Code Playgroud) 我试图理解Object和Object.prototype之间的区别.因为要创建一个空对象,所以使用了Object.prototype.我觉得为什么不反对.
我通过以下方式创建对象.
方法1:
o = Object.create(Object.prototype,{ p : {value: "test"} });
console.log(o.__proto__);
Run Code Online (Sandbox Code Playgroud)
结果是:
Object {__defineGetter__: function, __defineSetter__: function, hasOwnProperty: function, __lookupGetter__: function, __lookupSetter__: function…}
Run Code Online (Sandbox Code Playgroud)
和
console.log(o)
Run Code Online (Sandbox Code Playgroud)
结果是
Object {p: "test"}
p : "test"
__proto__ : Object
constructor : function Object()
hasOwnProperty : function hasOwnProperty()
isPrototypeOf : function isPrototypeOf()
propertyIsEnumerable : function propertyIsEnumerable()
toLocaleString : function toLocaleString()
toString : function toString()
valueOf : function valueOf()
__defineGetter__ : function __defineGetter__()
__defineSetter__ : function __defineSetter__()
__lookupGetter__ : function __lookupGetter__()
__lookupSetter__ : function __lookupSetter__() …Run Code Online (Sandbox Code Playgroud) 我有如下情况:
state = {
items: [.....list of items]
filteredcount: count of filtered items done by selector
}
Run Code Online (Sandbox Code Playgroud)
我有一个带有以下代码的组件来传递状态属性。
const mapStateToProps = (state,ownProps) => {
return {
items: getItems(state.items,ownProps.condition),
filteredcount: state.filteredcount
}
Run Code Online (Sandbox Code Playgroud)
在 getItems 选择器中,我想调度一个操作来更新过滤计数。
const getItems = (results,condition){
filteredresults = ...filter results here based on condition
dispatch(updatenumber(filteredresults.length))
return filteredresults
}
Run Code Online (Sandbox Code Playgroud)
其中 updatenumber 是更新 state.filteredcount 的动作创建者
这该怎么做
我正在使用 axios 获取 api 响应。
我正在发送按名称排序的 api 响应http://localhost:8000/api/ingredients/ordering=name
从我的服务器发送的实际对象如下。
{
2:{"id":2,"name":"anil"},
1:{"id":1,"name":"sant"},
3:{"id":3,"name":"vino"}
}
Run Code Online (Sandbox Code Playgroud)
或将密钥作为字符串而不是整数传递
{
"2":{"id":2,"name":"anil"},
"1":{"id":1,"name":"sant"},
"3":{"id":3,"name":"vino"}
}
Run Code Online (Sandbox Code Playgroud)
或字母数字键
{
"a2":{"id":2,"name":"anil"},
"a1":{"id":1,"name":"sant"},
"a3":{"id":3,"name":"vino"}
}
Run Code Online (Sandbox Code Playgroud)
axios 正在做的是对对象进行键排序,并且名称不按排序顺序
{
1:{"id":1,"name":"sant"},
2:{"id":2,"name":"anil"},
3:{"id":3,"name":"vino"}
}
Run Code Online (Sandbox Code Playgroud)
或者如果键是字母数字
{
a1:{"id":1,"name":"sant"},
a2:{"id":2,"name":"anil"},
a3:{"id":3,"name":"vino"}
}
Run Code Online (Sandbox Code Playgroud)
如何阻止这个
我不想要数组格式的列表,因为我必须稍后根据 id 更新各个对象。这种表示很容易。我正在使用reactjs状态。
我正在使用Django Rest Framework视图和序列化器创建一个html注册表单.以前我使用Django视图和表单创建了注册表单.在Django中,其Usercreation表单已准备就绪,但在DRF中不可用.
我从Django源代码中找到了以下Usercreationform代码:
class UsernameField(forms.CharField):
def to_python(self, value):
return unicodedata.normalize('NFKC', super().to_python(value))
class UserCreationForm(forms.ModelForm):
"""
A form that creates a user, with no privileges, from the given username and
password.
"""
error_messages = {
'password_mismatch': _("The two password fields didn't match."),
}
password1 = forms.CharField(
label=_("Password"),
strip=False,
widget=forms.PasswordInput,
help_text=password_validation.password_validators_help_text_html(),
)
password2 = forms.CharField(
label=_("Password confirmation"),
widget=forms.PasswordInput,
strip=False,
help_text=_("Enter the same password as before, for verification."),
)
class Meta:
model = User
fields = ("username",)
field_classes = {'username': UsernameField}
def __init__(self, …Run Code Online (Sandbox Code Playgroud) 我有一个 .m3u8 网址,即http://example.com/test.m3u8
我可以通过ffmpeg命令下载它:
ffmpeg -y -loglevel verbose -i "http://example.com/test.m3u8" -c copy -f mpegts test.mp4
Run Code Online (Sandbox Code Playgroud)
但我正在尝试手动执行此操作:
我尝试了以下方法:
1)下载m3u8文件:
wget -O test.m3u8 "http://example.com/test.m3u8"
Run Code Online (Sandbox Code Playgroud)
2)然后将每个段下载到一个文件夹中:
aria2c -i test.m3u8
Run Code Online (Sandbox Code Playgroud)
这将下载文件夹中的所有 .ts 文件。
3)然后我把它们结合起来
cat *.ts > out.ts
Run Code Online (Sandbox Code Playgroud)
4)然后我尝试转换为mp4:
$ ffmpeg -i out.ts -c:v libx264 outputfilename.mp4
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg …Run Code Online (Sandbox Code Playgroud) 我正在使用来自 docker hub 的 archlinux/base 官方镜像。
我正在尝试使用 systemctl 并且它说。
$ docker run --rm -it ac16c4b756ed systemctl start httpd
System has not been booted with systemd as init system (PID 1). Can't operate.
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题。
before_script我觉得在工作中需要用到什么。script它可以在自身内部组合在一起
deploy-to-stage:
stage: deploy
before_script:
- "which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )"
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
script:
- *** some code here ***
Run Code Online (Sandbox Code Playgroud)
如果他们要一个接一个地跑
我可以理解before_script所有工作都有共同点,因为它节省了一些样板文件
目前我正在使用 openvpn3 客户端连接到 vpn 服务器
openvpn3 session-start --config /home/user/client.ovpn
Run Code Online (Sandbox Code Playgroud)
然后它要求输入用户名和密码。
有没有简单的方法来传递用户名和密码。因为每次都要输入用户名和密码很烦人
如何使用axios进行批处理请求:
我有以下批量请求
POST /batch HTTP/1.1
Content-Type: multipart/mixed; boundary=====1340674896===
--====1340674896===
GET /contacts/479038 HTTP/1.1
Content-Type: application/json
--====1340674896===
GET /contacts/299430 HTTP/1.1
Content-Type: application/json
--====1340674896===--
Run Code Online (Sandbox Code Playgroud)
如何使用axios获得响应:我正在尝试以下
const config = {
headers: {
'content-type': 'multipart/mixed; boundary=====1340674896==='
}
}
axios.post('/batch',data,config)
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
Run Code Online (Sandbox Code Playgroud)
如何传递数据
--====1340674896===
GET /contacts/479038 HTTP/1.1
Content-Type: application/json
--====1340674896===
GET /contacts/299430 HTTP/1.1
Content-Type: application/json
--====1340674896===--
Run Code Online (Sandbox Code Playgroud)