Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Apparently as stated <a href="https://stackoverflow.com/a/13351391/281545">here</a> it is not possible.</p> <p>What I did was altogether drop the "root layout" (see <code>battery_details.xml</code>). So I create a fragment layout for my MonitorActivity :</p> <pre><code>public class MonitorActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_monitor); } } </code></pre> <p>where the layout is :</p> <pre><code>&lt;!-- activity_monitor.xml --&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MonitorActivity" &gt; &lt;fragment android:name="di.k23b.hw3.fragments.MonitorDetailsFragment" android:id="@+id/monitor_details" android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent" /&gt; &lt;fragment android:name="di.k23b.hw3.fragments.MonitorPrefsFragment" android:id="@+id/monitor_preferences" android:layout_weight="2" android:layout_width="0dp" android:layout_height="match_parent" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>and in MonitorDetailsFragment class :</p> <pre><code>public class MonitorDetailsFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.battery_details, container, false); // NEVER TRUE ! } } </code></pre> <p>where the <code>battery_details.xml</code> (created in <code>res/layout</code>) :</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/batteryTextHealth" android:layout_width="120dp" android:layout_height="wrap_content" android:ems="10" android:text="BATTERRRYYY" android:textIsSelectable="true" &gt; &lt;/TextView&gt; </code></pre> <p>Works. So maybe you can edit the layout you use the fragments, add the <code>&lt;LinearLayout&gt;</code> there and just put the elements of the <code>&lt;LinearLayout&gt;</code> directly into the layout you use in the <code>OnCreateView</code> - dropping the merge tags</p>
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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