I am facing an issue with the layout inflater where the inflated layout appears in the center of the page instead of the intended right corner placement. I have attempted to modify the gravity to right, but it did not resolve the problem.
Below is a snippet of my XML file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="150dp"
android:layout_height="200dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:background="@color/primary"
android:orientation="vertical"
android:layout_alignParentEnd="true">
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:id="@+id/linshare"
android:paddingTop="5dp"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:background="@drawable/share"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:text="Share"
android:textSize="16sp"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:textColor="#FFFFFF"
android:layout_height="match_parent" />
</LinearLayout>
<!-- More LinearLayouts here -->
</RelativeLayout>
Here is a snippet of the code section:
private void menz() {
LayoutInflater layoutInflater = LayoutInflater.from(Additionone.this);
View promptView = layoutInflater.inflate(R.layout.menuinflate, null);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(Additionone.this);
alertDialogBuilder.setView(promptView);
final LinearLayout share = (LinearLayout) promptView.findViewById(R.id.linshare);
// Other LinearLayout assignments and onClickListeners below
}
Screenshot: https://i.sstatic.net/r5ZgI.png