In Android, what is window insertion?

It sounds like a dumb question, and I'm sorry if that is the case, but I searched around to get a visual idea of ​​what they were and didn't come up with anything.

Here is what Android has to say about it:

WindowInsets are immutable and can be extended to further include more types of inserts.

http://developer.android.com/reference/android/view/WindowInsets.html

Google images auto-adjust it before inserting a window ...

Why will anyone work with these "inserts"? Do they have anything to do with the navigation bar on mobile phones without home physical keys?

+7
android window
source share
2 answers

This is a kind of color marker (used in Android Wear).

They are used to indent from the main content to the actual border:

Here are some examples here .


This image is with two inserts: circle / square.

enter image description here


They can also be used in other views to handle specific rendering requirements, for example, in ScrollView : where to put the current scroll can be determined using innerInset, as indicated in this question .

 <ScrollView android:id="@+id/view2" android:layout_width="100dip" android:layout_height="120dip" android:padding="8dip" android:scrollbarStyle="insideInset" android:background="@android:color/white" android:overScrollMode="never"> 
+4
source share

You can use onApplyWindowInsets :

 @Override public void onApplyWindowInsets(WindowInsets insets) { super.onApplyWindowInsets(insets); mRound = insets.isRound(); } 

to determine if the wearable Android device is round or square, then using this information, draw the appropriate application interface (with a round or square background)

+2
source share

All Articles