Note that there are some explanatory texts on larger screens.

plurals
  1. POtabs and fragments android eclipse
    text
    copied!<p>I have a problem. I just created an app in which I can navigate through tabs and sections. How can i tell eclipse to load me the "main.xml" layout and not to create a new Linear layout with a text view? Is it possible guys?</p> <pre><code>@TargetApi(Build.VERSION_CODES.HONEYCOMB) public class FirstTabFragment extends Fragment { private Activity activity; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { this.activity = getActivity(); LinearLayout linearLayout = new LinearLayout(activity); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); linearLayout.setLayoutParams(params); TextView textView = new TextView(activity); textView.setText("This is a sample fragment. I am programmatically added"); linearLayout.addView(textView); return linearLayout; } } </code></pre> <p>My main.xml code is: </p> <pre><code>&lt;RelativeLayout 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" tools:context=".MainActivity" android:background="@drawable/screenshot1" &gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginTop="167dp" android:text="Button" /&gt; &lt;Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/button1" android:layout_below="@+id/button1" android:layout_marginTop="44dp" android:text="Button" /&gt; </code></pre> <p></p>
 

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