1, TextView the content is too long to omit and scroll
Android:singleline= "true",//single line
Android:ellipsize= "",//Start middle end omitted position
Android:marqueerepeatlimit= ""//Marquee marquee Marquee_forever keep rolling
2, call the system comes with the tool transfer files
Intent.setaction (intent.action_send). SetType ("*/*"). PutExtra (Intent.extra_stream, Uri.fromfile (file)).
Call Bluetooth transfer:
Setaction (Intent.action_bluetooth);
3, Intent
Explicit intent: Implemented by specifying the name of the intent component, which is typically implemented within the same application, with the knowledge of the target component name .
implicit intent: implemented by intent filter, which is generally used without explicitly stating the name of the target component, and is generally intended for use in different applications Room.
The Settype and SetData methods will clear each other, and Android provides a Setdataandtype () method to solve
View Plaincopy to Clipboardprint?
- Public Intent setData (Uri data) {
- Mdata = data;
- Mtype = null;
- return this;
- }
View Plain
- Public Intent setType (String type) {
- Mdata = null;
- Mtype = type;
- return this;
- }
4, ActionBar:
Setdisplayhomeasupenabled (Boolean enable) displays the return icon
public boolean onoptionsitemselected (MenuItem item) {
Case Android. R.id.home:
Setdisplayshowtitileenabled () ...
5. Custom theme:
Android:elevation Actionbar The width of the shadow @null No
Android:colorprimarydark Screen Top status bar
Android:homeasupindicator Actionbar return arrow @drawable/IC_ARROW_BACK_24DP
Android:actionoverflowbuttonstyle ActionBar
<!--Action Bar overflow menu icon. -
<style name= "Blacklistactionbaroverflowqp" parent= "@android: Style/widget.material.light.actionbutton.overflow ">
<item name= "Android:src" > @drawable/ic_menu_overflow_lt</item>
</style>
6. Androidxliff XML Localization interchange File format:xml Local Data Interchange Format
<resources xmlns:xliff= "urn:oasis:names:tc:xliff:document:1.2" >
<string name= "Mms_size_expiry" > "Message size:& #160; <xliff:g id=" COUNT ">%1$d</xliff:g>&# 160; kb,& #160;& #160;& #160; expires:& #160; <xliff:g id= "Time" >%2$s</xliff:g> "</string>
Mcontext.getstring (r.string.mms_size_expiry, size, expiry)
%n$s N represents the first few arguments, S is the string
%n$ms m represents the total length, if the string length is greater than M, the string is displayed, if less than the number of spaces after the string is displayed
%N$MD m Fill 0
%N$MF m=2.3 Format 00.000
7. Get permission for SMS operation:
Android5.0 for text message insertion and modification permissions to control, only the system default SMS app to operate the SMS. Rights Management classes:
Appopsmanager.java appopsservice.java//get permission: Packagemanager Packagemanager = Context.getpackagemanager (); Appopsmanager Appopsmanager = (appopsmanager) context.getsystemservice (Context.app_ops_service); PackageInfo info = packagemanager.getpackageinfo (package_name, packagemanager.get_uninstalled_packages); Boolean isignored = appopsmanager.mode_ignored = = Appopsmanager.checkop (appopsmanager.op_write_sms, Info.applicationInfo.uid, package_name); if (isignored) { //Turn on appopsmanager.setmode (appopsmanager.op_ Write_sms, Info.applicationInfo.uid, Package_name, appopsmanager.mode_allowed);} if (isignored) { //off Appopsmanager.setmode (appopsmanager.op_write_sms, Info.applicationInfo.uid, Package_ NAME, appopsmanager.mode_ignored);} Permission, <uses-permission android:name= "Android.permission.UPDATE_APP_OPS_STATS"/>
8. Change the system default SMS app:
Intent Intent = new Intent (Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT) Intent.putextra (Telephony.Sms.Intents.EXTRA _package_name, Selfpackagename); startactivity (intent); Telephony.Sms.getDefaultSmsPackage (Context context) //Get the default SMS app PackageName
Android Small Knowledge Slice