我已经创建了一个小测试应用程序来尝试缩放drawable.
我在xml中定义了drawable并将其保存为scale_up.xml.我有一个main.xml带有的布局文件ImageView.我android:src="@drawable/scale_up"在ImageView中使用我在xml中创建的drawable.在我的活动中,我myImageView.setImageLevel(some level here)用来设置定义的ImageView的级别main.xml.一切都很好,ImageView显示了scale_up中定义的drawable.
我的困惑如下:
scaleHeight和scaleWidth%in scale_up.xml不会产生可感知的差异setImageLevel(在0到10000之间)的级别会改变图像的大小 - 实际上只能在5000左右看到.scaleHeight和scaleWidth的%值越高,图像越小(取决于值setImageLevel())我想我的问题是:
setImageLevel(),在0到10000之间传递一个级别 - 在活动中控制xml文件中定义的drawable的大小?setImageLevel()- 之间的关系是什么,正如我现在看到的那样,我也可以将scaleHeight和scaleWidth设置为100%,然后使用setImageLevel(5000)得到50%缩放图像 - 即增加或减少setImageLevel(0 to 10000)将改变比例 - 制作在scaleHeight和scaleWidth%相当没有意义的.感谢对此的任何澄清,也许是一个如何正确使用scale drawable(在xml中定义)的示例.
我有一个使用 Amplify Auth 的 Android 应用程序。我可以使用访客访问和密钥,但不能使用会话令牌。使用临时凭证时, Postman 需要会话令牌。
根据Amplify 文档,我使用以下代码来获取密钥:
Amplify.Auth.fetchAuthSession(
result -> {
Log.i(TAG, "inside getGuestCredentials()...result....." + result.toString());
AWSCognitoAuthSession cognitoAuthSession = (AWSCognitoAuthSession) result;
Log.i(TAG, "Is user signed in: " + cognitoAuthSession.isSignedIn());
switch (cognitoAuthSession.getIdentityId().getType()) {
case SUCCESS:
Log.i(TAG, "Guest IdentityId: " + cognitoAuthSession.getIdentityId().getValue());
Log.i(TAG, "Guest access key: " + cognitoAuthSession.getAWSCredentials().getValue().getAWSAccessKeyId());
Log.i(TAG, "Guest secret key: " + cognitoAuthSession.getAWSCredentials().getValue().getAWSSecretKey());
String sessionToken = ((AWSSessionCredentials) mobileClient.getCredentials()).getSessionToken();
Log.i(TAG, "Guest sessionToken: " + sessionToken);
break;
case FAILURE:
Log.i(TAG, "failure Guest IdentityId not present …Run Code Online (Sandbox Code Playgroud) android postman amazon-cognito aws-amplify aws-amplify-sdk-android