我需要SearchView从我的创建arrayList<String>并在下拉列表中显示相同的建议
我寻找教程,逐步解释如何SearchView在操作栏中构建一个.
我已经阅读了文档,并按照谷歌的例子,但它对我没用.
我创建了搜索
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/action_search"
android:title="Search"
android:icon="@android:drawable/ic_menu_search"
android:showAsAction="always"
android:actionViewClass="android.widget.SearchView" />
</menu>`
Run Code Online (Sandbox Code Playgroud)
但我不知道如何设置字符串数组的参数.我试图在不同的Activity中检索结果但不起作用.
如何将正则表达式java转换为正则表达式javascript
例如,我有这样的文本:#hello some text #Home
我的 Java 正则表达式是
String regex = "[#]+[A-Za-z0-9-_]+\\b";
Pattern tagMatcher = Pattern.compile("[#]+[A-Za-z0-9-_]+\\b");
Run Code Online (Sandbox Code Playgroud)
结果是#hello 和#Home
我的 JavaScript 代码是:
var myRegExp = new RegExp("[#]+[A-Za-z0-9-_]+\\b");
var tagMatcher = text.match(myRegExp);
Run Code Online (Sandbox Code Playgroud)
但结果是:
#你好
我该如何解决这个问题?
我的错误在哪里?
我想以弹出模式以编程方式打开 ionSelect。
@ViewChild('selectNotificationList') selectNotificationList: IonSelect;
Run Code Online (Sandbox Code Playgroud)
打开离子选择的方法是:
clickNotificationNumber() {
this.selectNotificationList.interface = 'popover';
this.selectNotificationList.open();
}
Run Code Online (Sandbox Code Playgroud)
HTML是:
<ion-card slot="end" class="langCard">
<ion-card-content>
<ion-select interface ="popover" (ionChange)="readNotification($event)" #selectNotificationList>
<ion-select-option *ngFor="let message of notificationList let notificationIndex = index" value="{{message.id}}">
{{message.notificationOptions.body}}</ion-select-option>
</ion-select>
</ion-card-content>
</ion-card>
Run Code Online (Sandbox Code Playgroud)