小编suk*_*uku的帖子

如何为android创建矢量drawable?

我是新来的VectorDrawables.

我可以看到,默认vector drawables提供与Android工作室一样ic_menu_gallery,ic_menu_camera等都是伟大的工作.所以我尝试vector drawables通过将我转换png imagessvg第一个并使用路径和填充值来制作矢量drawables 来创建我自己的东西,即替换svg文件中的android:pathDatafor d和android:fillColorfill标签.它以某种方式给了矢量drawables但扭曲或curlituted看.

如果我没有采取正确的方法,请建议我.

java svg android android-studio android-vectordrawable

50
推荐指数
5
解决办法
8万
查看次数

如何在按钮单击时更改矢量可绘制路径的颜色

随着新的Android支持更新,矢量drawables获得向后兼容性.我有一个带有各种路径的矢量图像.我希望通过单击按钮或基于输入值以编程方式更改路径的颜色.是否可以访问矢量路径的name参数?然后改变颜色.

android vector vector-graphics android-vectordrawable

37
推荐指数
5
解决办法
4万
查看次数

AWS Cognito错误:'identityPoolId'无法满足约束

我是新的Cognito.我正在尝试使用Lambda实现AWS Cognito.这是我关注的教程.

AmazonCognitoIdentityClient client =
                new AmazonCognitoIdentityClient();
    GetOpenIdTokenForDeveloperIdentityRequest tokenRequest = new GetOpenIdTokenForDeveloperIdentityRequest();
    tokenRequest.setIdentityPoolId("us-east-1_XXXXXXX");
Run Code Online (Sandbox Code Playgroud)

这是我在setIdentityPoolId中使用的池ID

在此输入图像描述

这是JUnit测试

public class AuthenticateUser implements RequestHandler<Object, Object> {

@Override
public Object handleRequest(Object input, Context context) {

    AuthenticateUserResponse authenticateUserResponse = new AuthenticateUserResponse();
    @SuppressWarnings("unchecked")
    LinkedHashMap inputHashMap = (LinkedHashMap)input;
    User user = authenticateUser(inputHashMap);
    return null;
}

public User authenticateUser(LinkedHashMap input){
    User user = null;
    String userName = (String) input.get("userName");
    String passwordHash = (String) input.get("passwordHash");

    try {
        AmazonDynamoDBClient client = new AmazonDynamoDBClient();
        client.setRegion(Region.getRegion(Regions.US_EAST_1));
        DynamoDBMapper mapper = new DynamoDBMapper(client); …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-cognito

36
推荐指数
1
解决办法
2万
查看次数

执行softmax_cross_entropy_with_logits时的ValueError

我正在关注tensorflow教程.最近的张量流更新softmax_cross_entropy_with_logits()已经修改了成本函数.因此,本教程中的代码给出以下错误:

ValueError: Only call softmax_cross_entropy_with_logits with named arguments (labels=..., logits=..., ...)

它是什么意思以及如何纠正它?

这是整个代码,直到那一点:

import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot = True)

n_nodes_hl1 = 500
n_nodes_hl2 = 500
n_nodes_hl3 = 500

n_classes = 10
batch_size = 100

x = tf.placeholder('float', [None, 784])
y = tf.placeholder('float')

def neural_network_model(data):
hidden_1_layer = {'weights':tf.Variable(tf.random_normal([784, n_nodes_hl1])),
                  'biases':tf.Variable(tf.random_normal([n_nodes_hl1]))}

hidden_2_layer = {'weights':tf.Variable(tf.random_normal([n_nodes_hl1, n_nodes_hl2])),
                  'biases':tf.Variable(tf.random_normal([n_nodes_hl2]))}

hidden_3_layer = {'weights':tf.Variable(tf.random_normal([n_nodes_hl2, n_nodes_hl3])),
                  'biases':tf.Variable(tf.random_normal([n_nodes_hl3]))}

output_layer = {'weights':tf.Variable(tf.random_normal([n_nodes_hl3, n_classes])),
                'biases':tf.Variable(tf.random_normal([n_classes])),}


l1 = tf.add(tf.matmul(data,hidden_1_layer['weights']), hidden_1_layer['biases']) …
Run Code Online (Sandbox Code Playgroud)

tensorflow

20
推荐指数
1
解决办法
5946
查看次数

如何将viewpager放入android中的片段?

我有一个活动,我可以在此活动的framelayout上显示一些片段.我想在片段内放一个由片段组成的viewpager而不是FragmentActivity.如何才能做到这一点?

android fragment android-viewpager

17
推荐指数
1
解决办法
3万
查看次数

Angular 5测试:预计在'ProxyZone'中运行,但未找到

我使用Angular cli创建了一个新的Angular 5项目.当我运行默认测试时,我收到以下错误:

Error: Expected to be running in 'ProxyZone', but it was not found.
at Function.webpackJsonp.../../../../zone.js/dist/proxy.js.ProxyZoneSpec.assertPresent (http://localhost:9876/_karma_webpack_/webpack:/home/sukumar/workspace/bizAnalyst/partnerportal/node_modules/zone.js/dist/proxy.js:38:1)
Run Code Online (Sandbox Code Playgroud)

如何纠正这个问题?

PS:Angular版本:5.2.1

angular

16
推荐指数
1
解决办法
4792
查看次数

角度垫表错误:缺少标题和行的定义

我正在使用Angular Material 5.2.5中的MatTable.我试图用通过服务器请求获得的数据填充表.

用户界面

  <mat-table [dataSource]="dataSource">
    <ng-container matColumnDef="number">
      <mat-header-cell *matHeaderCellDef>#</mat-header-cell>
      <mat-cell *matCellDef="let i = index">{{i + 1}}</mat-cell>
    </ng-container>
    <ng-container matColumnDef="name">
      <mat-header-cell *matHeaderCellDef>Name</mat-header-cell>
      <mat-cell *matCellDef="let user">{{user.userName}}</mat-cell>
    </ng-container>
    ...
  </mat-table>
Run Code Online (Sandbox Code Playgroud)

组件代码

  public dataSource = new MatTableDataSource<User>()
  public displayedColumns = ['number', 'name', 'email', 'phone', 'joiningDate']
Run Code Online (Sandbox Code Playgroud)

在从服务器接收数据时向dataSource添加数据

 onGettingPartnerUsers(userList: User[]) {
  console.log('userList', userList)
  if (!Util.isFilledArray(userList)) {
    // TODO show message no user found
  } else {
    this.dataSource.data = userList
  }
 }
Run Code Online (Sandbox Code Playgroud)

我正在获取用户列表.但是这个错误正在被抛出.

Error: Missing definitions for header and row, cannot determine which columns should be …
Run Code Online (Sandbox Code Playgroud)

angular-material angular

15
推荐指数
1
解决办法
2万
查看次数

11
推荐指数
4
解决办法
7533
查看次数

在node.js/Java中编写的AWS Lambda函数是否存在任何性能/功能差异

我计划将AWS Lambda用于应用程序的后端.与node.js相比,我对Java更熟悉,但我看到node.js中的Lambda函数比Java更受欢迎.基于Java和基于nodejs的lambda函数之间是否存在性能差异?

java amazon-web-services node.js aws-lambda

10
推荐指数
1
解决办法
6919
查看次数

应用程序图标未设置,它始终显示默认的绿色android图标

我按照教程和其他堆栈溢出问题的建议执行了以下步骤:

  1. 清单中的android:icon ="@ mipmap/ic_launcher",其中app图标名为ic_launcher,并且所有mipmap已根据分辨率进行了适当替换
  2. 使用Android Asset Studio生成的图像替换所有mipmap图像
  3. 我通过右键单击res选择了图像资源中的相应文件.
  4. 我已经卸载了旧的应用程序.重新安装应用程序然后运行
  5. 我已经使缓存无效并重新启动了Android Studio
  6. 重启手机
  7. 在图像资源中也添加了512*512像素的图像.

我怀疑的问题是,当我启动图像资源时,默认值是剪贴画而不是图像.因此,每次运行应用程序时,它可能会拾取默认的剪贴画图标.

我还在工具栏中保留了应用程序图标.这有时会改变.如果该应用程序再次运行,它将更改回默认的绿色android图标.

我有新的android studio 2.1.那么这方面有问题吗?

icons android android-icons android-studio

9
推荐指数
1
解决办法
9125
查看次数