Android Custom Control Foundation Part 2
I. RectF and Rect
1. Does it contain a point
boolean contains(float x, float y)
An example can be written based on this: Draw a rectangle to determine if your finger is in range.
public class BasisView extends View {
private int mX, mY;
private RectF rectF;
private Paint mPaint;
public BasisView(Context context) {
...
Added by lucianoes on Fri, 03 Sep 2021 20:28:36 +0300
_ Kotlin_ Series_ 2, Kotlin generic, byte Android Senior Engineer Interview
2. What is the use of generics?
3. How to define and use generics?
1. What is generics?
The popular understanding of generics is that many types allow us to program without specifying specific types by using the concept of parameterized types
2. What is the use of generics?
Generics is a security mechanism introduced by JDK 1.5 and a techn ...
Added by magic2goodil on Fri, 03 Sep 2021 09:17:54 +0300
ScrollView (RecyclerView, etc.) does not look at absolute blood loss
@Override
public void requestChildFocus(View child, View focused) {
if (!mIsLayoutDirty) {
scrollToChild(focused);
} else {
mChildToScrollTo = focused;
}
super.requestChildFocus(child, focused);
}
Because the requestLayout() method was called before addViewInner:
@Override
public void requestLayout() {
mIsLayou ...
Added by Pehape on Fri, 03 Sep 2021 08:51:56 +0300
The new function of Fragment, setMaxLifecycle, has lasted for 30 days
INITIALIZING initial state CREATED created status ACTIVITY_CREATED fully created but not started STARTED creates and starts, visible and inoperable RESUMED creation is started and operable [picture uploading... (image-1940e7-1557923091355-0)]
This article only explains the CREATED, STARTED and RESUMED states. Since the mState ...
Added by NeoGeo on Fri, 03 Sep 2021 04:04:01 +0300
WebView interactive architecture project practice (I) in-depth understanding of JVM
android:layout_width="match_parent"
android:layout_height="match_parent"/>
......
</LinearLayout>
``````
// MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
...
Added by pyfsapple on Fri, 03 Sep 2021 02:59:55 +0300
Kotlin: high order function, small code farmers also have big dreams
1.1. Higher order function when function is used as function parameter
Here we introduce sumBy{} higher-order functions in strings. Take a look at the source code first
// Source code of sumBy function
public inline fun CharSequence.sumBy(selector: (Char) -> Int): Int {
var sum: Int = 0
for (element in this) {
...
Added by shneoh on Fri, 03 Sep 2021 01:44:50 +0300
Pangu and Nuwa in the Java World - Zygote, it's really a sudden enlightenment
registerServerSocketFromEnv registers the server socket for cross process communication. Binder communication is not used here.preload() to perform the preload operationgcAndFinalize(), take the initiative to conduct a garbage collection before forkSystemServerforkSystemServer(), create SystemServer processrunSelectLoop(), waiting for the socke ...
Added by tfburges on Thu, 02 Sep 2021 10:57:45 +0300
Flutter-Performance optimization: Picture placeholders, pre-caching and disable navigation transition animation, byte hopping social recruitment interview records
The following GIF diagram shows the layout jump without a picture placeholder:
See the full example in DartPad
If you have cached a picture placeholder in your app, you can use FadeInImage Widgets to display placeholders.If you want to use a widget instead of a picture as a placeholder, you can use Image.frameBuilder&nbs ...
Added by piznac on Thu, 02 Sep 2021 03:38:23 +0300
What does App do to never crash, done in minutes
Does try catch affect program performance?
First, try catch is used to minimize the scope as much as possible. When no exception is thrown within the try catch scope, the performance impact is small, but when an exception is thrown, the performance impact is multiplied.Specifically, I have conducted a simple test for the following three cases ...
Added by raouleduke on Wed, 01 Sep 2021 19:42:03 +0300
FFmpeg-Audio Video Decoding is synchronized with Audio Video, one of the technical questions interviewers must ask
mExecutorService.submit(new Runnable() {
@Override
public void run() {
AVUtils.audioPlay(input_video_file_path);
}
});
break;
}
}
@Override
public void onFinish() {
runOnUiThread(new Runnable() {
@Override
public vo ...
Added by pornost4r on Wed, 01 Sep 2021 19:31:45 +0300