More Android UIs
-
Upload
dennis-jung -
Category
Software
-
view
22 -
download
0
Transcript of More Android UIs
List● To show items in vertical
scrolling list● Use ListView component● Item format can be
customized, and most of apps are doing this way.
ListView● Add ListView component● Default list only contains string● Item format can be customized,
and most of apps are doing this way.
ArrayAdapter● Set list items threw ArrayAdapter.● android.R.layout.simple_list_item_1 -> Default list format provided by Android
ListView● setOnItemClickListener -> Set onItemClickListener for list items● ...ClickListener -> Usually used to get response after click certain item
Fragment● Piece of an application's user interface that can be placed in an Activity.● Single Acvitity contains single/multiple fragment, and each of it can be used
like Activity● Used for dynamic & multi-pane UI
Start Fragment● onCreateView -> Creating view layout of fragment● inflate.inflate? -> Create View instance with defined resource
o In this case, set View with R.layout.fragment_main resource file
Start Fragment● FragmentManager -> Interface for interacting with Fragment
● FragmentTransaction -> Add a fragment to the activity state
o In code above, use FragmentTransaction.replace to input layout to target fragment
Start Fragment● Try this~
● Refer: http://examples.javacodegeeks.com/android/core/app/fragment/android-fragments-example/
DrawerLayout● Container for window content that allows for interactive "drawer" views to be
pulled out from the edge of the window.
DrawerLayout● FrameLayout: Layout for
setting main view
● ListView: List which will be setting on drawer
● DrawerLayout is included on Android v4 Support Library package
● For more, look on http://developer.android.com/tools/support-library/features.html#v4