= do not have to use the parent attribute. <style name="CodeFont.Red"> <item name="android:textColor">#FF0000</item> </style> <style name="CodeFont.Red.Big"> <item name="android:textSize">30sp</item> </style>
motion, and interaction design across platforms and devices. Guideline != rule Using on pre lollipop: <application android:theme="@style/Theme.AppCompat" > compile 'com.android.support:appcompat-v7:21.0.3' Using on lollipop: <application android:theme="@android:style/Theme.Material”>
Translation: dynamic component used for animations. <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/next" android:elevation="5dp" /> or View.setElevation() View.setTranslationZ()
all functionality of material design. If you do not use any of the new XML attributes, will work on previous versions of Android. Alternative Layouts For lollipop use res/layout-v21/ and for other res/layout/.
on the action bar items switch (item.getItemId()) { case R.id.action_search: openSearch(); return true; case R.id.action_compose: composeMessage(); return true; default: return super.onOptionsItemSelected(item); } }
bulk message (email) CATEGORY_PROMO Promotion or advertisement CATEGORY_PROGRESS Progress of a operation CATEGORY_SOCIAL Social network or sharing update CATEGORY_ERROR Error in background operation CATEGORY_RECOMMENDATION A specific, timely recommendation for a single thing. etc.
be hidden VISIBILITY_PUBLIC shows the notification's full content. VISIBILITY_SECRET doesn't show any part on the lock screen. VISIBILITY_PRIVATE shows basic information, but hides the full content.
who gets to be on top? OS will decide Takes into account: • Timestamp • Application's stated priority • Has sound or vibration • Any people attached to the notification and are they starred contacts.
{ public void onClick(DialogInterface dialog, int id) { // User clicked OK button } }); builder.setNegativeButton(R.string.cancel, new DialogInterface. OnClickListener() { public void onClick(DialogInterface dialog, int id) { // User cancelled the dialog } }); AlertDialog dialog = builder.create(); dialog.show()
with a checkbox that is either enabled or disabled. ListPreference Dialog with a list of selections. EditTextPreference Dialog with EditText widget. + custom preference
(developed using the Android SDK) • as a web application (developed using web standards and accessed through a web browser). <?xml version="1.0" encoding="utf-8"?> <WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent"/> WebView myWebView = (WebView) findViewById(R.id.webview); myWebView.loadUrl("http://www.example.com");
Instantiate the interface and set the context */ WebAppInterface(Context c) { mContext = c; } /** Show a toast from the web page */ @JavascriptInterface public void showToast(String toast) { Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show(); } }