我正在开发一个软键盘并且运行良好,但我不知道如何为长按键自定义弹出式布局.
<?xml version="1.0" encoding="UTF-8"?>
<android.inputmethodservice.KeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:keyPreviewLayout="@layout/preview"
android:keyBackground="@drawable/key_selector"
android:shadowRadius="0.0"
android:keyTextColor="#000000"
/>
Run Code Online (Sandbox Code Playgroud)
<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:keyHeight="10%p">
<Row android:verticalGap="1%p" android:horizontalGap="0.5%p" android:keyHeight="8%p" android:keyWidth="9.6%p">
<Key android:codes="113" android:keyLabel="q" />
<Key android:codes="119" android:keyLabel="w" />
<Key android:codes="101" android:keyLabel="e"
/>
<Key android:codes="114" android:keyLabel="r" />
<Key android:codes="116" android:keyLabel="t" />
<Key android:codes="121" android:keyLabel="y"
android:popupKeyboard="@xml/keyboard_popup" android:popupCharacters="yýÿ"/>
<Key android:codes="117" android:keyLabel="u"
android:popupKeyboard="@xml/keyboard_popup" android:popupCharacters="uúù?ûü"/>
<Key android:codes="105" android:keyLabel="i"
android:popupKeyboard="@xml/keyboard_popup" android:popupCharacters="iíì?îï"/>
<Key android:codes="111" android:keyLabel="o"
android:popupKeyboard="@xml/keyboard_popup" android:popupCharacters="oóòõôö" />
<Key android:codes="112" android:keyLabel="p" />
</Row>
<Row android:verticalGap="1%p" android:horizontalGap="0.5%p" android:keyHeight="8%p" android:keyWidth="9.6%p"> …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用https://developers.google.com/cloud-messaging/android/client来实现GCM for android .
Created configuration file and placed under project/src..Added all the permissions in manifest file..
still onHandleIntent() method is not getting called, and token is not generated..
My intentservice file:
public class RegistrationIntentService extends IntentService {
private static final String TAG = "RegIntentService";
private static final String[] TOPICS = {"global"};
public RegistrationIntentService() {
super(TAG);
}
@Override
public void onDestroy() {
Log.d(TAG, "onDestroy()");
super.onDestroy();
}
@Override
protected void onHandleIntent(Intent intent) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
try { …Run Code Online (Sandbox Code Playgroud) 我有一个简单的tableViewController,一个searchBar带范围和一个navigationBar.
当我点击我的searchBar我看到我的范围和所有工作。然后我单击一行并转到我DetailPage的搜索栏并没有隐藏(我不知道为什么)。
所以我点击取消,然后我回到我的tableView. 当我返回到我的 tableView 时,我SearchBar和我的NavigationBar.
这是我的代码:
self.resultSearchController = ({
let controller = UISearchController(searchResultsController: nil)
controller.searchResultsUpdater = self
controller.hidesNavigationBarDuringPresentation = true
controller.dimsBackgroundDuringPresentation = false
controller.searchBar.sizeToFit()
controller.searchBar.scopeButtonTitles = ["Title", "Author", "Location", "Price", "User"]
self.tableView.tableHeaderView = controller.searchBar
return controller
})()
func updateSearchResults(for searchController: UISearchController)
{
let scopes = resultSearchController.searchBar.scopeButtonTitles
let currentScope = scopes![resultSearchController.searchBar.selectedScopeButtonIndex] as String
filterContentForSearchText(searchText: searchController.searchBar.text!, scope: currentScope)
}
Run Code Online (Sandbox Code Playgroud)