• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Top Tips for Android UIs
 

Top Tips for Android UIs

on

  • 2,753 views

For more information about developing Android application for the MOTOROLA XOOM go to http://developer.motorola.com

For more information about developing Android application for the MOTOROLA XOOM go to http://developer.motorola.com

Statistics

Views

Total Views
2,753
Views on SlideShare
2,753
Embed Views
0

Actions

Likes
1
Downloads
81
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Top Tips for Android UIs Top Tips for Android UIs Presentation Transcript

    • Suzanne AlexandraAndroidMotorola Mobility UIMOTOROLA Stylized M Motorola Trademark Holdings, LLC. . . © 2011 Motorola Mobility, Inc. All rights reserved.
    • @suzalex #appsum11krdeveloper.motorola.com 1.0 2009 2 24
    • 01020304
    • 010203 , ,04 Fragment
    • ?alignParentLeft alignParentRight
    • centerHorizontal="true" <RelativeLayout>layout_alignLeft layout_alignRight
    • ( )
    • Android
    • Honeycomb
    • Notification.BuilderNotification.Builder builder = new Notification.Builder( this );AlertDialog.Builder
    • builder.setSmallIcon(R.drawable.icon) .setContentTitle(title) .setContentText(text) .setContentIntent(pintent) // Pending Intent .setLargeIcon(myBitmap);
    • setLargeIcon() setSmallIcon() setContentTitle() setContentText()
    • -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 Intentelse // Activity Intent
    • 01020304
    • . Brain RulesDr. John Medina
    • Android? ? ? ?
    • –32 MB324 KB23 MB728 KB
    • ..
    • BitmapFactory.Options options = new BitmapFactory.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;}
    • 010203 , ,04
    • Honeycomb Theme.Holo Theme.Holo.Light
    • <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"> <style … parent= "@android:style/Theme.Holo">
    • 01020304 Fragment
    • XOOM ..
    • <item android:showAsAction="ifRoom" … > onCreateOptionsMenu()android:actionLayout onOptionsItemSelected()android: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 - @Override public 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.BuilderXMLDialogFragment
    • Honeycomb Honeycombprivate static boolean isHoneycomb = android.os.Build.VERSION.SDK_INT > 10;if (isHoneycomb) { //} else //}
    • Fragment
    • Fragment
    • Fragment Fragment
    • Fragment
    • Fragment Activity FragmentFragment gridFrag = getFragmentManager(). findFragmentById(R.id.photogrid);Fragment photoFrag = getFragmentManager(). findFragmentById(R.id.the_frag);
    • Fragmentprivate 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_STARTEDACTION_DRAG_ENTERED
    • ACTION_DROPACTION_DRAG_ENDED
    • Fragment
    • startDrag() - ? – OnLongClickListener() ClipData DragShadowBuilderpublic boolean onLongClick(View v) { ClipData data = ClipData.newPlainText("foo","bar"); DragShadowBuilder shadowBuilder = new DragShadowBuilder(v); v.startDrag(data, shadowBuilder, v, 0); return true;}
    • onDrag() (OnDragListener ) onDragclass 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/) .