Below is my XML code. I want to display toast just above linearlayout (id: inside_linear) by leaving some margin. I know that we can use setGravity() method of toast. But how can I calculate yoffset?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:id="@+id/relative">
<LinearLayout
android:id="@+id/outside_linear"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal"
android:weightSum="10">
<FrameLayout
android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8"/>
<LinearLayout
android:id="@+id/inside_linear"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:orientation="vertical"
android:gravity="center_horizontal">
.....
</LinearLayout>
</RelativeLayout>