I am trying to create layout on Android, to look the same as on the image. Problem is, I don't know how put only half of button inside parent view, and another one outside. I need something to align center of button to the edge of parent. I know, it's possible with java code, but I want to avoid it. Any sugestions? Sorry for my english.
You don't have to put the button into that view as a child, but over the view in a higher Z order with a different bottom margin.
You can start from this example:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="30dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="40dp"
android:background="@android:color/darker_gray"
android:orientation="vertical">
</LinearLayout>
<Button
android:layout_width="150dp"
android:layout_height="80dp"
android:background="@android:color/holo_green_dark"
android:layout_gravity="bottom|center_horizontal"/>
</FrameLayout>
This is how it looks like:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.