Upload
motorola-mobility-motodev
View
2.447
Download
0
Tags:
Embed Size (px)
DESCRIPTION
For more information about developing Android application for the MOTOROLA XOOM go to http://developer.motorola.com
Citation preview
UI
MOTOROLA Stylized M Motorola Trademark Holdings, LLC. . . © 2011 Motorola Mobility, Inc. All rights reserved.
Suzanne AlexandraAndroid Motorola Mobility
1.0 2009 2 24
@suzalex#appsum11kr
developer.motorola.com
01
02
03
04
01
02
03, ,
04
Fragment
?
alignParentLeft alignParentRight
centerHorizontal="true"
layout_alignLeft<RelativeLayout>layout_alignRight
( )
Android
Honeycomb
Notification.Builder
Notification.Builder builder = new Notification.Builder( this );
AlertDialog.Builder
builder.setSmallIcon(R.drawable.icon).setContentTitle(title).setContentText(text).setContentIntent(pintent) // Pending Intent.setLargeIcon(myBitmap)
;
setSmallIcon()setLargeIcon()
setContentText()setContentTitle()
-
RemoteViews layout = new RemoteViews(getPackageName(), R.layout.notification);
layout.setTextViewText(R.id.notification_title, getString(R.string.app_name));
layout.setOnClickPendingIntent(R.id.notification_button,getDialogPendingIntent("Tapped") );
builder.setContent(layout);
private static boolean isHoneycomb =android.os.Build.VERSION.SDK_INT > 10;
if (!isHoneycomb)// Activity Intent
else// Activity Intent
01
02
03
04
.
Brain RulesDr. John Medina
Android?
??
?
–
32 MB 324 KB
23 MB 728 KB
.
.
BitmapFactory.Options options = newBitmapFactory.Options();
options.inJustDecodeBounds = false;options.inSampleSize = 4;options.inScaled = true;options.inTargetDensity = screenDensity;
Bitmap bitmap = BitmapFactory.decodeResource(
getResources(),R.drawable.clover, options);
public View getView( int position, View convertView, ViewGroup parent) {
ImageView i = new ImageView(mContext);i.setImageResource(mImageIds[position]);
i.setLayoutParams(new Gallery.LayoutParams(300, 200));
i.setScaleType(ImageView.ScaleType.FIT_XY);i.setBackgroundResource(
mGalleryItemBackground);
return i;}
01
02
03, ,
04
Theme.Holo
Theme.Holo.Light
Honeycomb
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:hardwareAccelerated="true" >
Honeycomb
Android
<uses-sdk android:minSdkVersion="8"android:targetSdkVersion="11" />
Android
<style … parent="@android:style/Theme.Holo">
<style … parent="@android:style/Theme">
01
02
03
04
Fragment
XOOM ..
onCreateOptionsMenu()
<item android:showAsAction="ifRoom" … >
onOptionsItemSelected()android:actionLayoutandroid:actionViewClass
1 – API 11
<uses-sdk android:minSdkVersion="8"android:targetSdkVersion="11" />
2 –
<item android:id="@+id/favorite"android:title="@string/favorite" android:icon="@drawable/ic_menu_star" android:showAsAction="ifRoom" />
3 -
@Overridepublic boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {case R.id.favorite:
// return true;
…}
<style name="MyTheme"parent="android:style/Theme.Holo" >
<item name="android:actionBarStyle">@style/ActionBar</item>
</style>
<style name="ActionBar" parent="android:style/Widget.Holo.ActionBar">
<item name="android:background">@drawable/my_background</item>
</style>
AlertDialog.Builder
XML
DialogFragment
Honeycomb Honeycomb
private static boolean isHoneycomb =android.os.Build.VERSION.SDK_INT > 10;
if (isHoneycomb) {//
} else//
}
Fragment
Fragment
FragmentFragment
Fragment
FragmentActivity Fragment
Fragment gridFrag =getFragmentManager().findFragmentById(R.id.photogrid);
Fragment photoFrag = getFragmentManager().findFragmentById(R.id.the_frag);
Fragment
private boolean photoInline = false;
photoInline = (photoFrag != null && getResources().getConfiguration().orientation== Configuration.ORIENTATION_LANDSCAPE);
if (photoInline) {//
} else if ( photoFrag != null) {gridFrag.getView().setVisibility(View.GONE);
}
Fragment
Fragment– Fragment
(1 )
<set><objectAnimator
xmlns:android=http://schemas.android.com/apk/res/android
android:propertyName="x" android:valueType="floatType"android:valueFrom="-1280"android:valueTo="0" android:duration="500" />
</set>
Fragment– Fragment
(2 )
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.setCustomAnimations( R.anim.slide_in_left, R.anim.slide_out_right );
DetailsFragment newFrag = DetailsFragment.newInstance();
ft.replace(R.id.details_fragment_container, newFrag, "detailFragment");
ft.commit();
ACTION_DRAG_STARTED
ACTION_DRAG_ENTERED
ACTION_DROPACTION_DRAG_ENDED
Fragment
- ?– OnLongClickListener()
ClipData DragShadowBuilder
startDrag()
public boolean onLongClick(View v) {ClipData data = ClipData.newPlainText("foo","bar");DragShadowBuilder shadowBuilder = new DragShadowBuilder(v);v.startDrag(data, shadowBuilder, v, 0);return true;}
(OnDragListener )onDrag
onDrag()
class BoxDragListener implements OnDragListener {
public boolean onDrag(View self, DragEvent event) {if (event.getAction() ==
DragEvent.ACTION_DRAG_STARTED) {//
} //
}
?@suzalex | @motodev
Motorola Mobility Inc. .Copyright © 2010-2011, Motorola, Inc. All rights reserved( ).
2 ., .
2 , / .
Motorola, Inc. .
" " () . , , , ,
( , , , ), ( ) ,
.
Apache 2.0Copyright © 2010, Android Open Source Project. All rights reserved( ).
Apache , 2.0(" "); . http://www.apache.org/licenses/LICENSE-2.0 .
"" . .
Creative Commons 3.0
Google (http://code.google.com/policies.html) Creative Commons 3.0 (http://creativecommons.org/licenses/by/3.0/) .