In the project to achieve a picture a at the same time displayed in the middle of two blocks, the height of the general
The middle Orange border part is a piece, the green border part is a piece, their background color one is black one is half black
Then the picture to be displayed across two blocks should be placed in the Green border section
First, it's important to add the orange border and the green border to the root layout .
Android:clipchildren= "false"
Such as:
<linearlayout android:layout_width= "match_parent" android:layout_height= "Match_parent" android: Clipchildren= "false" android:orientation= "vertical" >
When you set the view in the code, get the height of the a graph, and then set the margintop of the Layoutparam of the A graph to be: half of the negative a graph height
Linearlayout.layoutparams LP = new Linearlayout.layoutparams (LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); Lp.setmargins (0,-mmenuimageview.getheight ()/2, 0, 0);
Now, this picture shows it's like two zones at the same time.
Android settings ImageView across two layout blocks