我在我的应用程序中放置了Android导航组件。
某些过渡效果很好,但是对此我有一个错误。来自片段A的过渡视图保留在新片段(B)上并隐藏一些元素。此外,当我滚动片段时,视图不会随之滚动。这是我得到的错误:
W/t.qoqa.ui.debu: Accessing hidden method Landroid/view/GhostView;->removeGhost(Landroid/view/View;)V (greylist-max-p, reflection, denied)
I/GhostViewApi21: Failed to retrieve removeGhost method
java.lang.NoSuchMethodException: android.view.GhostView.removeGhost [class android.view.View]
Run Code Online (Sandbox Code Playgroud)
我从片段A中的RecyclerView开始,在其中单击时,我设置了唯一的过渡名称。
然后,我将该名称作为参数使用SafeArgs以及FragmentNavigatorExtras中的视图进行传递。
在片段B中,我延迟了onCreate:中的过渡, postponeEnterTransition()
并设置了过渡类型:
transition = TransitionSet().apply {
addTransition(ChangeTransform())
addTransition(ChangeBounds())
startDelay = 150
}
sharedElementEnterTransition = transition
sharedElementReturnTransition = transition
Run Code Online (Sandbox Code Playgroud)
我在onViewCreated中设置名称: ViewCompat.setTransitionName(product_image, args.imageTransitionName)
最后,当准备好显示图像时,Glide Listener开始过渡:
listener = object: RequestListener<Drawable> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,
target: Target<Drawable>?,
isFirstResource: Boolean
): Boolean {
startPostponedEnterTransition()
return false
}
override fun onResourceReady(
resource: Drawable?,
model: Any?,
target: Target<Drawable>?,
dataSource: DataSource?, …Run Code Online (Sandbox Code Playgroud) android android-transitions shared-element-transition android-architecture-navigation androidx
尝试使用Diagnostic和CodeFix来创建一个代码转换为:
variable = variable + 1;
otherVariable = otherVariable -1;
Run Code Online (Sandbox Code Playgroud)
成:
variable++;
otherVariable--;
Run Code Online (Sandbox Code Playgroud)
已完成诊断(可行):
var incrementing = node as BinaryExpressionSyntax;
if (incrementing != null)
{
string right = incrementing .Right.ToString();
string left = incrementing .Left.ToString();
if (right == left + " - 1" || right == left + " + 1")
{
addDiagnostic(Diagnostic.Create(Rule, incrementation.GetLocation(), "Use the shorter way"));
}
}
Run Code Online (Sandbox Code Playgroud)
编辑: 我做了一些改变.现在始终识别递增.该程序进入CodeFix,但我的ReplaceToken与SyntaxFactory不起作用.(它现在仅用于"++"而不是" - "):
if (node.IsKind(SyntaxKind.SimpleAssignmentExpression)) //I use a node instead of a token
{
var IncrementationClause = (BinaryExpressionSyntax)node;
string …Run Code Online (Sandbox Code Playgroud) 我正在尝试为Visual Studio做一个扩展,它改变了代码中的一些语法.实际上,我已经完成了第一步,即改变变量的名称,如果这个名称不是我们在公司使用的规则.例如:
int newVariable;
double test;
Run Code Online (Sandbox Code Playgroud)
将改为:
int iNewVariable;
double dblTest;
Run Code Online (Sandbox Code Playgroud)
现在我必须更改此类评论:(SingleLineComment)
//this is a single line Comment
Run Code Online (Sandbox Code Playgroud)
进入MultiLineComment
/*Here it's a MultiLine one*/
Run Code Online (Sandbox Code Playgroud)
我使用Roslyn语法Visualiser来查找制作正确代码的类型和种类,但没有任何作用.这就是我为Diagnostic做的事情:
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace CodeFix
{
[DiagnosticAnalyzer]
[ExportDiagnosticAnalyzer(DiagnosticId, LanguageNames.CSharp)]
public class DiagnosticAnalyzer : ISyntaxNodeAnalyzer<SyntaxKind>
{
internal const string DiagnosticId = "CodeFix";
internal const string Description = "Mauvais formattage";
internal const string MessageFormat = "'{0}'";
internal const string Category = "Correction"; …Run Code Online (Sandbox Code Playgroud) 我有这个记录:
SELECT sc.no, scl.quantite, scl.description, scl.poids, scl.prix, sl_ref.refsl, sl_ref.codetva, sl_ref.tauxtva, sl_ref.compte
FROM shop_commande
AS sc, shop_commande_ligne AS scl, selectline_ref AS sl_ref
WHERE sc.id = scl.shop_commande_id
AND sl_ref.refshop = ISNULL(scl.shop_article_id, 0)
AND sc.id NOT IN (SELECT id_command FROM selectline_flag)
Run Code Online (Sandbox Code Playgroud)
有时,在sl_shop_article_id中,有一个NULL值。我想要的是将其替换为0,这样子句:
sl_ref.refshop = scl.shop_article_id
Run Code Online (Sandbox Code Playgroud)
即使scl.shop_article_id为NULL 也可以工作。为此,我尝试使用ISNULL函数,但它使请求出错,并且出现错误:
1582-对本机函数“ ISNULL”的调用中的参数计数不正确
如何使用?