Handling Keyboard Input | Android Developers

文章推薦指數: 80 %
投票人數:10人

The Android system shows an on-screen keyboard—known as a soft input method—when a text field in your UI receives focus. To provide the best user experience ... Quicknav Quicknav Design Develop Distribute GooglePlayDeveloperConsole AndroidDevelopersBlog AboutAndroid Android.com AndroidDevelopers AndroidOpenSourceProject close GetStarted Style Patterns BuildingBlocks Downloads Videos Training APIGuides Reference Tools GettheSDK GoogleServices GooglePlay Publishing Promoting AppQuality Spotlight OpenDistribution Results Loading... Training APIGuides Reference Tools GoogleServices totop GettingStarted BuildingYourFirstApp CreatinganAndroidProject RunningYourApplication BuildingaSimpleUserInterface StartingAnotherActivity ManagingtheActivityLifecycle StartinganActivity PausingandResuminganActivity StoppingandRestartinganActivity RecreatinganActivity SupportingDifferentDevices SupportingDifferentLanguages SupportingDifferentScreens SupportingDifferentPlatformVersions BuildingaDynamicUIwithFragments UsingtheSupportLibrary CreatingaFragment BuildingaFlexibleUI CommunicatingwithOtherFragments SavingData SavingKey-ValueSets SavingFiles SavingDatainSQLDatabases InteractingwithOtherApps SendingtheUsertoAnotherApp GettingaResultfromtheActivity AllowingOtherAppstoStartYourActivity SharingContent SendingContenttoOtherApps ReceivingContentfromOtherApps AddinganEasyShareAction BuildingAppswithMultimedia ManagingAudioPlayback ControllingYourApp'sVolumeandPlayback ManagingAudioFocus DealingwithAudioOutputHardware CapturingPhotos TakingPhotosSimply RecordingVideosSimply ControllingtheCamera BuildingAppswithGraphics&Animation DisplayingBitmapsEfficiently LoadingLargeBitmapsEfficiently ProcessingBitmapsOfftheUIThread CachingBitmaps DisplayingBitmapsinYourUI DisplayingGraphicswithOpenGLES BuildinganOpenGLESEnvironment DefiningShapes DrawingShapes ApplyingProjectionandCameraViews AddingMotion RespondingtoTouchEvents AddingAnimations CrossfadingTwoViews UsingViewPagerforScreenSlide DisplayingCardFlipAnimations ZoomingaView AnimatingLayoutChanges BuildingAppswith Connectivity&theCloud ConnectingDevicesWirelessly UsingNetworkServiceDiscovery ConnectingwithWi-FiDirect UsingWi-FiDirectforServiceDiscovery PerformingNetworkOperations ConnectingtotheNetwork ManagingNetworkUsage ParsingXMLData TransferringDataWithoutDrainingtheBattery OptimizingDownloadsforEfficientNetworkAccess MinimizingtheEffectofRegularUpdates RedundantDownloadsareRedundant ModifyingPatternsBasedontheConnectivityType SyncingtotheCloud UsingtheBackupAPI MakingtheMostofGoogleCloudMessaging BuildingAppswith UserInfo&Location RememberingUsers RememberingYourUser AuthenticatingtoOAuth2Services CreatingaCustomAccountType MakingYourAppLocationAware UsingtheLocationManager ObtainingtheCurrentLocation DisplayingaLocationAddress BestPracticesfor UserExperience&UI DesigningEffectiveNavigation PlanningScreensandTheirRelationships PlanningforMultipleTouchscreenSizes ProvidingDescendantandLateralNavigation ProvidingAncestralandTemporalNavigation PuttingitAllTogether:WireframingtheExampleApp ImplementingEffectiveNavigation ImplementingLateralNavigation ImplementingAncestralNavigation ImplementingTemporalNavigation ImplementingDescendantNavigation NotifyingtheUser BuildingaNotification PreservingNavigationwhenStartinganActivity UpdatingNotifications UsingBigViewStyles DisplayingProgressinaNotification AddingSearchFunctionality SettinguptheSearchInterface StoringandSearchingforData RemainingBackwardCompatible DesigningforMultipleScreens SupportingDifferentScreenSizes SupportingDifferentScreenDensities ImplementingAdaptiveUIFlows DesigningforTV OptimizingLayoutsforTV OptimizingNavigationforTV HandlingFeaturesNotSupportedonTV CreatingCustomViews CreatingaCustomViewClass ImplementingCustomDrawing MakingtheViewInteractive OptimizingtheView CreatingBackward-CompatibleUIs AbstractingtheNewAPIs ProxyingtotheNewAPIs CreatinganImplementationwithOlderAPIs UsingtheVersion-AwareComponent ImplementingAccessibility DevelopingAccessibleApplications DevelopingAccessibilityServices BestPracticesfor UserInput UsingTouchGestures DetectingCommonGestures TrackingMovement AnimatingaScrollGesture HandlingMulti-TouchGestures DraggingandScaling ManagingTouchEventsinaViewGroup HandlingKeyboardInput SpecifyingtheInputMethodType HandlingInputMethodVisibility SupportingKeyboardNavigation HandlingKeyboardActions BestPracticesfor Performance PerformanceTips ImprovingLayoutPerformance OptimizingLayoutHierarchies Re-usingLayoutswith LoadingViewsOnDemand MakingListViewScrollingSmooth RunninginaBackgroundService CreatingaBackgroundService SendingWorkRequeststotheBackgroundService ReportingWorkStatus LoadingDataintheBackground RunningaQuerywithaCursorLoader HandlingtheResults OptimizingBatteryLife MonitoringtheBatteryLevelandChargingState DeterminingandMonitoringtheDockingStateandType DeterminingandMonitoringtheConnectivityStatus ManipulatingBroadcastReceiversOnDemand SendingOperationstoMultipleThreads SpecifyingtheCodetoRunonaThread CreatingaManagerforMultipleThreads RunningCodeonaThreadPoolThread CommunicatingwiththeUIThread KeepingYourAppResponsive JNITips SMPPrimerforAndroid BestPracticesfor Security&Privacy SecurityTips DevelopingforEnterprise EnhancingSecuritywithDeviceManagementPolicies UsingGooglePlayto Distribute&Monetize SellingIn-appProducts PreparingYourApp EstablishingProductsforSale PurchasingProducts TestingYourApp MaintainingMultipleAPKs CreatingMultipleAPKsforDifferentAPILevels CreatingMultipleAPKsforDifferentScreenSizes CreatingMultipleAPKsforDifferentGLTextures CreatingMultipleAPKswith2+Dimensions MonetizingYourApp AdvertisingwithoutCompromisingUserExperience HandlingKeyboardInput Previous Next Getstarted Dependenciesandprerequisites Android1.6(APILevel3)orhigher TheAndroidsystemshowsanon-screenkeyboard—knownasa softinputmethod—whenatextfieldinyourUIreceivesfocus. Toprovidethebestuserexperience,youcanspecifycharacteristics aboutthetypeofinputyouexpect(suchas whetherit'saphonenumberoremailaddress)andhowtheinputmethodshouldbehave(suchas whetheritperformsauto-correctforspellingmistakes). Inadditiontotheon-screeninputmethods,Androidalsosupportshardwarekeyboards,soit's importantthatyourappoptimizeitsuserexperienceforinteractionthatmightoccur throughanattachedkeyboard. Thesetopicsandmorearediscussedinthefollowinglessons. Lessons SpecifyingtheInputMethodType Learnhowtoshowcertainsoftinputmethods,suchasthosedesignedforphonenumbers,web addresses,orotherformats.Alsolearnhowtospecifycharacteristicssuch asspellingsuggestionbehaviorandactionbuttonssuchasDoneorNext. HandlingInputMethodVisibility Learnhowtospecifywhentoshowthesoftinputmethodandhow yourlayoutshouldadjusttothereducedscreenspace. SupportingKeyboardNavigation Learnhowtoverifythatuserscannavigateyourappusingakeyboard andhowtomakeanynecessarychangestothenavigationorder. HandlingKeyboardActions Learnhowtoresponddirectlytokeyboardinputforuseractions. Previous Next Nextclass: Exceptasnoted,thiscontentis licensedunder CreativeCommonsAttribution2.5.Fordetailsand restrictions,seetheContent License. AboutAndroid  |  Legal  |  Support



請為這篇文章評分?