DonBrody/Android-CustomKeyboard - GitHub
文章推薦指數: 80 %
Android-CustomKeyboard. Fully customizable Android keyboard written in Kotlin. Deprecated. This package is no longer maintained. I'm no longer an Android ...
Skiptocontent
{{message}}
DonBrody
/
Android-CustomKeyboard
Public
Notifications
Star
73
Fork
9
FullycustomizableAndroidkeyboardwritteninKotlin.
MITLicense
73
stars
9
forks
Star
Notifications
Code
Issues
5
Pullrequests
0
Actions
Projects
0
Wiki
Security
Insights
More
Code
Issues
Pullrequests
Actions
Projects
Wiki
Security
Insights
master
Branches
Tags
Couldnotloadbranches
Nothingtoshow
Loading
{{refName}}
default
Couldnotloadtags
Nothingtoshow
{{refName}}
default
Loading
1
branch
0
tags
Code
Loading
Latestcommit
Gitstats
20
commits
Files
Permalink
Failedtoloadlatestcommitinformation.
Type
Name
Latestcommitmessage
Committime
app
gradle/wrapper
.gitignore
CustomKeyboardLandscape.gif
CustomKeyboardPortrait.gif
LICENSE
README.md
build.gradle
gradle.properties
settings.gradle
Viewcode
Android-CustomKeyboard
Deprecated
Prerequisites
RunningtheDemo
WhyIMadeIt
HowItWorks
AdvancedUse
NextSteps
Dependencies
License
README.md
Android-CustomKeyboard
FullycustomizableAndroidkeyboardwritteninKotlin.
Deprecated
Thispackageisnolongermaintained.I'mnolongeranAndroiddeveloperandhavenotcommittedanycodeinacoupleofyearsnow.Pleasefeelfreetoforkthisprojectandmakeimprovementsasneeded.
Prerequisites
MakesureyouhaveaversionofAndroidStudioinstalledthatsupportsKotlin(3+shouldbefine).
RunningtheDemo
Justdownloadtheproject,openitinAndroidStudio,connecttoavirtualorphysicaldevice,andrunit!Thereshouldn'tbeanyfurtherconfigurationrequired(unlessyouneedtodownloadbuildtools,etc.,butAndroidStudioshouldpromptyoutodothat).
BelowareGIF'softhefunctionalityinbothladscapeandportrait.Noticethatinbothorientationsthekeyboardtakesupthefullscreenwidth,andthebuttonwidthschange(theyareapercentageofthescreenwidth).ThatisbecauseitextendstheResizableRelativeLayout.Additionally,thecomponentresponsiblefortheexpansionandcollapseofthekeyboardistheExpandableView.Pleasetakealookattheirdocumentationformoredetail.
WhyIMadeIt
TheAndroidsystemkeyboardAPIislimitedanddifficulttoworkwith.Ispentmanyhoursresearchingdifferentwaystogainfullcontrolofthekeyboard,andendeduppiecingtogetherafewdifferentapproachesandaddingsomeofmyownflavortoit.IhopethatIcansave
somebodyelsealotoftimeandheadache.
HowItWorks
TheCustomKeyboardViewcanbeinjectedwithanykeyboardlayoutandcontroller.AllyouneedtodoiscreateanEditText,passittotheCustomKeyboardView,andindicatewhatkeyboardtypeitshouldbeusing.BelowistheentireMainActivitydemoclass:
classMainActivity:AppCompatActivity(){
privatelateinitvarkeyboard:CustomKeyboardView
overridefunonCreate(savedInstanceState:Bundle?){
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
valnumberField:EditText=findViewById(R.id.testNumberField)
valnumberDecimalField:EditText=findViewById(R.id.testNumberDecimalField)
valqwertyField:EditText=findViewById(R.id.testQwertyField)
keyboard=findViewById(R.id.customKeyboardView)
keyboard.registerEditText(CustomKeyboardView.KeyboardType.NUMBER,numberField)
keyboard.registerEditText(CustomKeyboardView.KeyboardType.NUMBER_DECIMAL,numberDecimalField)
keyboard.registerEditText(CustomKeyboardView.KeyboardType.QWERTY,qwertyField)
valswitchActivitiesButton:Button=findViewById(R.id.switchActivitiesButton)
switchActivitiesButton.setOnClickListener{
startActivity(Intent(this@MainActivity,AdvancedFeaturesActivity::class.java))
}
}
overridefunonBackPressed(){
if(keyboard.isExpanded){
keyboard.translateLayout()
}else{
super.onBackPressed()
}
}
}
TheEditText'sarestoredinamapbytheCustomKeyboardView:
privatevalkeyboards=HashMap
延伸文章資訊
- 1Microsoft SwiftKey Keyboard - Google Play 應用程式
Microsoft SwiftKey is the intelligent keyboard that learns your writing style, so you can type fa...
- 2How can you make a custom keyboard in Android? - Stack ...
System keyboard. This answer tells how to make a custom system keyboard that can be used in any a...
- 3Create an input method | Android Developers
In this example, MyKeyboardView is an instance of a custom implementation of KeyboardView that re...
- 4How to create a custom keyboard with Xamarin Forms (Android)
Some time ago a client requested a special keyboard for his application, which had to have certai...
- 510 best Android keyboards for all kinds of typists
Hacker's Keyboard · Microsoft SwiftKey · Multiling O Keyboard · Simple Keyboard · Typewise Custom...