我正在开发一个用于学习目的的简单 React Native 应用程序。我只是迈出了进入 React Native 世界的第一步。但是在这个非常早期的阶段,我遇到了问题。我无法让简单的触摸事件工作。我正在使用 TouchableWithoutFeedback 实现触摸事件。这是我的代码。
class AlbumList extends React.Component {
constructor(props)
{
super(props)
this.state = {
displayList : true
}
}
componentWillMount() {
this.props.fetchAlbums();
}
albumPressed(album)
{
console.log("Touch event triggered")
}
renderAlbumItem = ({item: album}) => {
return (
<TouchableWithoutFeedback onPress={this.albumPressed.bind(this)}>
<Card>
<CardSection>
<Text>{album.artist}</Text>
</CardSection>
<CardSection>
<Text>{album.title}</Text>
</CardSection>
</Card>
</TouchableWithoutFeedback>
)
}
render() {
let list;
if (this.state.displayList) {
list = <FlatList
data={this.props.albums}
renderItem={this.renderAlbumItem}
keyExtractor={(album) => album.title}
/>
}
return (
list
)
}
}
const …Run Code Online (Sandbox Code Playgroud) 我对Android中的drawable的setbounds方法感到困惑.我知道它与drawable一起使用,它设置在drawable和它有多大的位置.简而言之,它定义了可绘制的边界矩形.但我很困惑:它是设置边框或填充或其宽度或高度?
这就是我们使用setbounds的方式
drawableInstance.setBounds(L,T,R,B);
Run Code Online (Sandbox Code Playgroud)
所以在上面的情况下,如果我分别为L,T,R,B设置5,5,5,5,则可绘制的L,T,R,B将始终分别来自其父项?我的意思是它会像是为每一侧设置隐藏的5px边框吗?此外,如果图像不足以满足其父级的边框宽度,图像会更大吗?
我分别为L,T,R,B设置了5,5,100,100.令我困惑的是,它将从父母5px开始绘制到顶部,从左边开始绘制5px.那将是起点.然后图像将是100px因为我设置100为正确.所以它是正确的100px.与右边相同.
但我测试了它.我认为两者都不如我所想.它是如何工作的,特别是与setBounds的每个参数有关?
我在我的PHP项目中使用Composer.但我并不擅长使用Composer.坦率地说,我是Composer的新手.现在,当我使用composer update命令更新我的依赖项时,它说我的Composer版本太旧并要求我更新.所以我尝试如下.但都失败了.
我的composer.phar档案在C:/ProgramData/ComposerSetup/bin/composer.phar
我打开终端试了一下
composer.phar update
php composer.phar update
composer C:/ProgramData/ComposerSetup/bin/composer.phar update
php composer C:/ProgramData/ComposerSetup/bin/composer.phar update
Run Code Online (Sandbox Code Playgroud)
当我运行时composer-self-update,错误就像截图一样.
所有命令都失败了 我正在使用XAMPP.composer.phar文件xampp/php夹中也没有文件.请问如何在Windows 10中更新Composer.
Button当我使用android:backgroundxml中的属性为其设置背景时,我遇到了视图问题.在设置背景之前,该按钮具有默认大小.但是,当我将颜色作为背景,这是挺大的,虽然我没有设置不同的width或者height在其上.
在将background属性设置为button之前,这是我的xml布局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:background="@color/white"
android:layout_gravity="center_horizontal"
android:id="@+id/btn_row_option_done"
android:text="Done"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:background="@color/white"
android:layout_gravity="center_horizontal"
android:text="Edit"
android:id="@+id/btn_row_option_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:layout_gravity="center_horizontal"
android:text="Delete"
android:id="@+id/btn_row_option_delete"
android:background="@color/red"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:layout_gravity="center_horizontal"
android:text="Cancel"
android:id="@+id/btn_row_option_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
所以取消按钮是默认大小,如截图.
但是当我在这样的取消按钮上设置颜色时
<Button
android:background="@color/white"
android:layout_gravity="center_horizontal"
android:text="Cancel"
android:id="@+id/btn_row_option_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)
然后按钮变得比默认大小更大,即使我没有使宽度或高度更大.
这是截图
如上所示,取消按钮变大了.其实我正在设置背景颜色.即使在设置背景颜色后,如何修复它以获得默认大小?
我正在使用 Node JS 无服务器框架构建微服务。说实话,这是我第一次使用 Serverless 构建微服务。我已经在我的计算机上配置了 AWS 凭证。
我创建了运行以下命令的项目。
serverless create -u https://github.com/codingly-io/sls-base -n aution-service
Run Code Online (Sandbox Code Playgroud)
然后我npm install在项目文件夹中运行。
这是我的 serverless.yml 文件夹。
service:
name: auction-service
plugins:
- serverless-bundle
- serverless-pseudo-parameters
provider:
name: aws
runtime: nodejs12.x
memorySize: 256
stage: ${opt:stage, 'dev'}
region: eu-west-2
functions:
hello:
handler: src/handlers/hello.handler
events:
- http:
method: GET
path: /hello
Run Code Online (Sandbox Code Playgroud)
我已经有了模板附带的 lambda 函数。然后我运行serverless deploy来部署服务。当我运行命令时,出现以下错误。
Error:
Object notation for "service" property is not supported. Set "service" property directly with service name.
Run Code Online (Sandbox Code Playgroud)
我的配置或代码有什么问题以及如何修复它?
我开始使用React JS开发Web应用程序.我从主题森林买了一个主题.在主题中,他们在组件中使用这样的组合.
...Other code here
Login.propTypes = {
classes: PropTypes.shape({}).isRequired,
width: PropTypes.string.isRequired
};
export default compose(withWidth(), withStyles(themeStyles, { withTheme: true }))(Login);
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,他们的代码在导出Component时最终使用了compose.我不能修改他们的内置结构.我现在喜欢做的是我也喜欢使用反应的连接功能.
通常连接用于撰写.现在,如果我想使用connect来处理应用程序的状态,我该如何将它与compose一起使用?
我正在开发一个主要使用的Android应用程序listview.但是我使用有问题Floating Action Button一起Long ListView.我的问题如下.
当列表视图只有几个项目时.Floating item看得见.
这是截图:
正如你在上面看到的,Floating Action Button仍然可以看出.但是当ListView有这么多物品并且对屏幕变得过分时,Floating Action Button无法看到.
这是截图 Long Listview
对于第二个屏幕截图,它不能再出现scrolled down了.
我想要实现的是,我希望浮动底部始终位于屏幕右上方Listview.在这样固定的位置HTML和CSS.
我想Floating Action Button一直在这里无论多么高Listview的
这是我的布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:dividerHeight="@dimen/list_item_divider_height"
android:padding="@dimen/list_padding"
android:divider="@color/whitesmoke"
android:id="@+id/listview_podcast_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"></ListView>
<TextView
android:textSize="17dp"
android:textStyle="bold"
android:textColor="@color/black"
android:textAlignment="center"
android:id="@+id/tf_no_records"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/stop_podcast_button"
android:background="@color/colorPrimary"
android:src="@android:drawable/ic_dialog_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"/>
</LinearLayout> …Run Code Online (Sandbox Code Playgroud) 我正在开发一个Android应用程序.在我的应用我使用CardView和ImageView在一起.但我在设计ImageView内部时遇到了问题CardView.拐角半径半径为的问题是ImageView.
我有像这样的适配器项目的XML布局.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
card_view:cardCornerRadius="5dp"
android:layout_width="match_parent"
android:id="@+id/di_card_container"
android:layout_height="wrap_content">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/di_iv_image"
android:scaleType="centerCrop"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout
android:padding="10dp"
android:layout_below="@id/di_iv_image"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:id="@+id/di_name_container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textSize="15dp"
android:textColor="@color/textColorPrimary"
android:id="@+id/di_tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
Run Code Online (Sandbox Code Playgroud)
正如你可以看到我设置的圆角半径CardView,以5dp与ImageView同是适合其母公司的宽度CardView.问题是它的顶角ImageView都没有像它的父CardView角一样弯曲.
这是截图
通常情况下,CardView如果父视角适合父视角,则视角会自动弯曲CardView.是对的吗?那我为什么ImageView不工作呢?
我正在使用 PHP 开发 Web 应用程序。在我的应用程序中,我需要使用预签名 URL 将文件上传到 AWS S3 存储桶。现在,我可以使用这样的预签名从 S3 存储桶中读取私有文件。
$s3Client = new S3Client([
'version' => 'latest',
'region' => env('AWS_REGION', ''),
'credentials' => [
'key' => env('AWS_IAM_KEY', ''),
'secret' => env('AWS_IAM_SECRET', '')
]
]);
//GetObject
$cmd = $s3Client->getCommand('GetObject', [
'Bucket' => env('AWS_BUCKET',''),
'Key' => 'this-is-uploaded-using-presigned-url.png'
]);
$request = $s3Client->createPresignedRequest($cmd, '+20 minutes');
//This is for reading the image. It is working.
$presignedUrl = (string) $request->getUri();
Run Code Online (Sandbox Code Playgroud)
当我$presignedUrl从浏览器访问时,我可以从 s3 获取文件。这是工作。但是现在,我正在将文件上传到 S3。不从 s3 读取文件。通常,我可以像这样将文件上传到 S3。
$client->putObject(array(
'Bucket' => $bucket,
'Key' …Run Code Online (Sandbox Code Playgroud) 我开始使用 Laravel 8 构建一个 Web 应用程序。我注意到 Laravel 8 中的很多事情都发生了变化,包括身份验证。现在,我正在尝试使用 Jetstream 进行身份验证。
我已运行以下命令将其集成到应用程序中。
composer require laravel/jetstream
php artisan jetstream:install inertia
npm install && npm run dev
Run Code Online (Sandbox Code Playgroud)
当我去/register路线时,我可以看到包含姓名、电子邮件、密码和密码确认字段的注册表。我想要做的是我想添加另一个名为“公司”的字段,我想对其应用自定义验证规则。
我在 Jetstream 文档中发现,我可以在 JetstreamServiceProvider 类的引导方法中自定义身份验证过程,如下所示。
Fortify::authenticateUsing(function (Request $request) {
});
Run Code Online (Sandbox Code Playgroud)
但不适用于注册。如何自定义注册过程添加新字段和应用自定义验证规则?
android ×4
php ×2
amazon-s3 ×1
composer-php ×1
laravel ×1
laravel-8 ×1
listview ×1
react-native ×1
react-redux ×1
reactjs ×1
recompose ×1
redux ×1
serverless ×1