I think a tidier solution to this is to add a FrameLayout into your existing LinearLayout, and add the RangeSeekBar into the FrameLayout. See below:
<!-- Activity Layout -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/layout_manage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<EditText android:id="@+id/test_edit_name"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText android:id="@+id/test_edit_type"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!-- This is the container for the RangeSeekBar -->
<FrameLayout
android:id="@+id/range_seek_bar_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right" />
</LinearLayout>
Your onCreate() method may look as follows:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RangeSeekBar rangeSeekBar = new RangeSeekBar<Integer>(20, 75, context);
ViewGroup rangeBarContainer = (ViewGroup) findViewById(R.id.range_seek_bar_container);
rangeBarContainer.addView(rangeSeekBar);
}
This makes it much easier to edit the RangeSeekBar's layout attributes
Update
Upon reading your new code, I noticed you are attempting to edit the layout of one of your Fragments from your Activity
code. You shouldn't do this. Work inside PlaceholderFragment
.
Your onCreateView() method inside PlaceholderFragment
:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.your_fragment_layout, container, false);
RangeSeekBar rangeSeekBar = new RangeSeekBar<Integer>(20, 75, context);
ViewGroup rangeBarContainer = (ViewGroup) rootView.findViewById(R.id.range_seek_bar_container);
rangeBarContainer.addView(rangeSeekBar);
return rootView;
}