ANDROID DEVELOPMENT #6 - brmlab › _media › event › android_6.pdf · ANDROID PROJECT...

Post on 07-Jun-2020

3 views 0 download

Transcript of ANDROID DEVELOPMENT #6 - brmlab › _media › event › android_6.pdf · ANDROID PROJECT...

ANDROID DEVELOPMENT

#6

@brmlab

středa, 27. března 13

UI LAYOUTS

LinearFrameTableRelativeGrid

středa, 27. března 13

VIEWGROUP

Can contain childrenSuperType for Layouts and ContainersCan contain Views and/or ViewGroups

Layouts can contain Layouts

středa, 27. března 13

LAYOUT XML FILE

Root element is singleViewGroupView

Must be XML file ( res/layouts/my_layout.xml )Can be provided multiple times (resources)

-xhdpi, -en-rGB, -sw600dp, -xlarge

středa, 27. března 13

LAYOUT PARAMS

layout_widthlayout_heightlayout_weight (of this view in parent view)layout_margin (outer spacing)layout_gravity (positioning in parent view)

středa, 27. března 13

OTHERPARAMS

gravity (inner content positioning)padding (inner spacing)weightSum (sum of all children layout_weight)id ( @id/my_id, @+id/my_id )

středa, 27. března 13

WEIGHT

ViewGroup {weightSum:4}View {weight:1}View {weight:1}View {weight:1}View {weight:1}

středa, 27. března 13

LAYOUTGRAVITY

středa, 27. března 13

(CONTENT) GRAVITY

středa, 27. března 13

LINEARLAYOUT

středa, 27. března 13

LINEARLAYOUT

středa, 27. března 13

FRAMELAYOUT

středa, 27. března 13

TABLELAYOUT

středa, 27. března 13

RELATIVELAYOUT

středa, 27. března 13

VIEWSPROGRAMATICALLY

ViewGroup extends ViewViewGroup.addView(View child)

LayoutParamsLinearLayout, FrameLayout, RelativeLayoutFrameLayout.LayoutParams

View.setLayoutParams(LayoutParams params)

středa, 27. března 13

VIEWS VISIBILITY

View.setVisibility(int)View.VISIBLE - defaultView.GONE - not using spaceView.INVISIBLE - just hidden, takes space

středa, 27. března 13

VIEWGROUPCHILDREN

View.findViewById(int)returns View, have to be re-typedeg. (TextView) findViewById(R.id.text)

searching through activity layout viewsearching through LayoutInflater result

středa, 27. března 13

VIEWGROUP CHILDREN

středa, 27. března 13

MAVENLATEST 3.0.5

Apache License 2.0Java toolDependency managementProject inheritancePackaging, Testing, Deploy, InstallPlugins / Modules for version controlAndroid module (build, run, package)

středa, 27. března 13

MAVEN INTEGRATION

Eclipse m2e pluginpom.xmlapklib not supported yet

apklib includes android resourcesjar dependencies supported

středa, 27. března 13

MAVEN PACKAGES

POM - Directory hierarchy with pom filesWAR - J2EE distribution (Sun)APK - Distribution (signed, unsigned)JAR - LibrariesAPKLIB - Android specific, includes resources

středa, 27. března 13

MAVENANDROID

Goalsandroid:cleanandroid:deploy / :redeployandroid:runandroid:devices (adb list-devices)android:emulator-*android:lintandroid:apk

středa, 27. března 13

MAVEN ECLIPSE

Maven Eclipse plugin

eclipse:eclipseeclipse:cleaneclipse:to-maveneclipse:configure-workspace

středa, 27. března 13

ANDROID PROJECT

Dependencies can be mixedMaven/libsEclipse classpath dependency (android.jar)referenced Android library projects

Must configure exporting librariescopying them to built APK archive

středa, 27. března 13

WHY MAVEN

Version dependencylibrary version update is handled

Hierarchy dependencylibrary that refers to library that refers ...

Automatic downloading Javadoc and Sources

středa, 27. března 13

WHY NOT MAVEN

APKLIB is not supportedEvery library providing resources =>

imageslayoutsdrawables

=> is not usable with Maven yeteg. ActionBarSherlock

středa, 27. března 13