KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am trying to add a fragment programmatically to a LinearLayout, but the fragment does not stretch its content across the whole layouts height. It acts like wrap_content instead of fill_parent. On the other side the fill_parent works on the fragment's width. How can I change this behaviour? DashboardActivity: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <fragment android:id="@+id/fragment_dashboard" android:layout_width="5dp" android:layout_height="fill_parent" android:layout_marginLeft="20dp" android:layout_weight="1" android:name="de.upb.cs.ginkgo.tablet.ui.fragments.DashboardFragment" > <!-- Preview: layout=@layout/fragment_dashboard --> </fragment> <LinearLayout android:id="@+id/rightfrag" android:layout_width="450dp" android:layout_height="fill_parent" android:layout_weight="1" android:layout_marginTop="10dp" android:layout_marginBottom="15dp" android:layout_marginRight="10dp" > </LinearLayout> </LinearLayout> Its onCreate method: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dashboard); //-- Instantiate Fragmentstuff FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); ActivitystreamFragment asf = new ActivitystreamFragment(); fragmentTransaction.add(R.id.rightfrag, asf); fragmentTransaction.commit(); } The ActivitystreamFragment XML: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:andro
Tags (comma-separated)
Save Edits
Cancel