当用户触摸网格布局时,如何获得敲击声?
How can I get the tap sound when a user touch a gridlayout?
如何在用户触摸网格布局时获得点击声音?
<GridLayout row="3" colSpan="2" columns="15*,75*,10*" height="12%" rows="*,*" class="card-large box" (tap)="onTap()">
<Label text="" class="fa centered icon-category" col="0" rowspan="2"></Label>
<Label text="MyText" class="category-name" verticalAlignment="bottom" col="1" row="0"></Label>
<Label text="numbers" verticalAlignment="top" col="1" row="1"></Label>
<Label text="" class="fa centered icon-arrow" col="2" rowspan="2"></Label>
</GridLayout>
更新:我可以通过访问 android 原生 api 来获得声音,这是代码:
让decorView:any = app.android.startActivity.getWindow().getDecorView()
decorView.playSoundEffect(android.view.SoundEffectConstants.CLICK)
但我想知道为什么点击 android 布局不会触发音效,..
以上代码应按预期工作。这是 a demonstration application where the sound effect is triggered when the user taps on the layout (the layout with the tap event 奇迹发生的地方)
如何在用户触摸网格布局时获得点击声音?
<GridLayout row="3" colSpan="2" columns="15*,75*,10*" height="12%" rows="*,*" class="card-large box" (tap)="onTap()">
<Label text="" class="fa centered icon-category" col="0" rowspan="2"></Label>
<Label text="MyText" class="category-name" verticalAlignment="bottom" col="1" row="0"></Label>
<Label text="numbers" verticalAlignment="top" col="1" row="1"></Label>
<Label text="" class="fa centered icon-arrow" col="2" rowspan="2"></Label>
</GridLayout>
更新:我可以通过访问 android 原生 api 来获得声音,这是代码:
让decorView:any = app.android.startActivity.getWindow().getDecorView() decorView.playSoundEffect(android.view.SoundEffectConstants.CLICK)
但我想知道为什么点击 android 布局不会触发音效,..
以上代码应按预期工作。这是 a demonstration application where the sound effect is triggered when the user taps on the layout (the layout with the tap event 奇迹发生的地方)