Note that there are some explanatory texts on larger screens.

plurals
  1. POFragment content position in Android
    primarykey
    data
    text
    <p>I was trying to fix this for a while and couldn't find the problem. I have a fragment in which I have ProgressBar that is centered. Here is the xml file content of fragment. </p> <pre><code>&lt;merge xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" &gt; &lt;ProgressBar android:id="@+id/progress_bar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /&gt; &lt;LinearLayout android:id="@+id/details_form" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="false" android:orientation="vertical" android:visibility="gone" &gt; ... &lt;/LinearLayout&gt; &lt;/merge&gt; </code></pre> <p>I also have activity and I just add this fragment to the activity. Here is the xml of activity </p> <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/details_container" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" tools:context=".MyActivity" tools:ignore="MergeRootFrame" /&gt; </code></pre> <p>The problem is when I navigate to this activity inside my application the progress is shown on the left side, it is not centered. I am not sure why is this happening, so I thought someone will see something I am missing. Thanks.</p> <p>EDIT:</p> <p>In onCreate event of my activity code (MyActivity.java) I have this code:</p> <pre><code>DetailsFragment detailsFragment = new DetailsFragment(); agreementDetailsFragment.setArguments(arguments); getSupportFragmentManager() .beginTransaction() .add(R.id.details_container, detailsFragment).commit(); </code></pre> <p>and in my fragment .java file in onCreateView I have this code</p> <pre><code>View rootView = null; /* * Get root view */ LinearLayout wrapper = new LinearLayout(getActivity()); inflater.inflate(R.layout.details_fragment, wrapper, true); rootView = wrapper; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload