Interface Programming for Android applications (4) and Android Interface Programming
Third group of UI components: ImageView and its subclass
The main function is to display images. Any Drawable object can be displayed using ImageView.
1. image browser
The image browser below can change the transparency of the image
Android.graphics.Rect class, which is similar to Android.graphics.RectF, differs in that the coordinates of a RECT class are represented by shaping, while the coordinates of RECTF are represented by a single-precision floating-point type. Everyone here must pay attention to AH. Seven, point class Android.graphics.PointThis class literally means that it is related to dots and is a point object class.This class has two properties, namely: x-coordinate and y-coordinate.There are three constructors
1. Get the Android source code and compile it.2. After compiling, remove the Classes.jar under the Out\target\common\obj\java_libraries\framework_intermediates path3. Rename the Classes.jar to Framework.jar and add it to the Libs directory of the Android studio project.4. In dependencies in Build.gradle, add:// Compile Filetree (inlcude: [' *.jar '], dir: ' Libs ') provided files ('Libs/framework.ja
A pleasing interface is very important for software, so graphic image resources are also very important. This talk is about one of the most important class drawable to deal with graphic images in Android. Drawable is an abstraction of an object that can be drawn (a bit awkward, you can do it), the following is its inheritance relationship, you see bitmapdrawable,animationdrawable and so on objects are its subclasses.
The easiest way to use drawable
Android studio-created AIDL cannot find a solution for custom classes during compilation. androidaidl
When you use AS to create an ADIL file, AS will generate an aidl folder and a package with the same package name under the main folder, we usually put all classes or files related to ADIL under this package. However, if a custom class exists, the program cannot p
Android Network-related tool classesYou can use it if you stick it.Package com.activity;Import java.util.List;Import Android.content.Context;Import Android.location.LocationManager;Import Android.net.ConnectivityManager;Import Android.net.NetworkInfo;Import Android.telephony.TelephonyManager;/*** Network-related tool classes*/public class NetUtils {/*** Whether the network is available** @param activity* @r
Android Date classes, date and calendar, date display, calendar calculation.Processing order: Calendar, Date, String.The example implements several more common methods:(1) The date is separated by the number of days;(2) string conversion date class;(3) The date of the previous acquisition;(4) Whether the judgment is more than today.Code: PackageMe.chunyu.Pedometer.manager;ImportAndroid.util.Pair;ImportJava.
loaded by default, and viewstub can better improve performance.
Ontrimmemory
Overriding this method in activity will call back when memory is tight (multiple levels are supported), allowing us to proactively release resources and avoid oom.
Edittxt.setimeoptions
When using EditText to eject the soft keyboard, modify the display of the ENTER key.
Textview.setcompounddrawablepadding
The code sets TextView drawable padding.
Imageswit
similarities. Developers only need to master these rules, you can achieve a beautiful and friendly GUI. In the next period of time, we will introduce them one after another. Today, let's first introduce the connection between Interface Programming and view components!
1. View components and container Components
In an activity file, we can see many packages:
import android.widget.EditText;import android.widget.ImageButton;import android.widget.ImageV
be avoided.
How does a weak pointer achieve this? To put it bluntly, it is not complicated because every object that can be referenced by a smart pointer is appended with another weakref_impl type object, this object records the strong pointer reference count and weak pointer reference count of the object. This object is used internally by the implementation of smart pointers, and users of smart pointers cannot see this object. The weak pointer operation is this object. this object will be de
,单位为pxpublic void getMetrics(DisplayMetrics outMetrics); // 返回显示区域的指标。详细能够查阅DisplayMetrics类
Actual display area: The area shows the window and system-related display of the app, in general, the size of the area and the physical screen size of the binding, unless the window manager simulates displaying the content on a small screen, The size of the zone can be obtained in the following ways:
public void getRealSize(Point outSize);public void getRealMetrics(DisplayMetrics
AUI thread processing. So why choose a double-ended queue, and why choose Lifolinkedblockingdeque as the default option?The double-ended queue is selected. Because Threadpoolexecutor is using the producer-consumer model, using Blockingqueue as the task processing queue within the Threadpoolexecutor class satisfies the requirements of the producer-consumer model for the task storage data structure. and in our assist. Lifolinkedblockingdeque is a subclass of Linkedblockingdeque. And Linkedblockin
dead. After Yang was awakened by the water to the shore, he saw many little bees. At a glance, he recognized the little dragon girl's bees, is mofeier nearby? Finally, under the water of Shen tan, Yang found his love for sixteen years. In the past, the little dragon girl learned that she had no medicine to save and jumped out of the cliff. During the 16-year period, she was just trying to prevent Yang from being easy. But after the cliff, the little dragon girl did not die. Then, in the bottom
Bitmap-called bitmaps, the general bitmap file format suffix bmp, of course, there are many encoders such as RGB565, RGB888. As a per-pixel display object, the execution efficiency is high, but the disadvantage is obvious that the storage efficiency is low. We understand that it's better to have a storage object.Drawable-as a generic graphic object for Android, it can load images in commonly used formats, such as GIF, PNG, JPG, and of course, BMP, and
disappear immediately A Public voidShow () {///and the object New Inner () is still using num2, but as mentioned earlier num2 has disappeared prematurely, so it will go wrong, add final at System.out.println (num); - //Access local variable num2 from inner class; need to be declared as final type -System.out.println (NUM2);//after---decompile you will see that the final effect is System.out.println (20), replacing the num2 directly with - } - }
Use of textview SpannableString and ImageSpan classes in android
Today I will explain the SpannableString and ImageSpan classes.
Bitmap bitmap = null;Bitmap = BitmapFactory. decodeResource (getResources (), imageIds [arg2% imageIds. length]);
// The first parameter includes the entire image resource and the second specified idImageSpan imageSpan = new ImageSpan (
ContentProvider to save the data).In order to be able to use context.startactivity (), all activity classes must define the associated "work" item in the Androidmanifest.xml file.The activity class is an important part of the Android application lifecycle. Here's a concrete summary of the various elements of the activity:I. The life cycle of activity
Ii. transfer of data between the activity1. Passing D
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.