I have a custom ScrollView that works fine if it is the only thing in the emulator. 

For example, this works fine:

```
    public class Timeline2Activity extends Activity {
        private TimelineView tlv;
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            tlv = new TimelineView(this);
            setContentView(tlv);
        }
    }

```

But if I first add widgets then it fails to appear. I've searched and experimented for 2 days and nothing works. 

Here is the class declaration of the custom ScrollView:

```
public class TimelineView extends ScrollView implements OnTouchListener {

```

And here are the constructors:

```
public TimelineView(Context context) {
    super(context);
this.setOnTouchListener(this);
setVisibility(VISIBLE);
}
//the following constructor is needed to inflate the view from XML
public TimelineView(Context context, AttributeSet ats) {
    super(context,ats);
this.setOnTouchListener(this);
setVisibility(VISIBLE);
}

```

Here is the main.xml:

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/container"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal" >

    <Button
        android:id="@+id/zoomall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Zoom All" />
    <Button
        android:id="@+id/zoomout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="-" />
    <Button
        android:id="@+id/zoomin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="+" />
    <Spinner 
        android:id="@+id/category_spinner"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:prompt="@string/category_prompt"
    />
    </LinearLayout>

    <com.projects.timeline2.TimelineView
        android:id="@+id/timeline_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>
</LinearLayout>

```

And here is the main program:

```
public class Timeline2Activity extends Activity {
    private TimelineView tlv;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //tlv = new TimelineView(this);
        //setContentView(tlv);
        setContentView(R.layout.main);

        Spinner spinnerCategory = (Spinner) findViewById(R.id.category_spinner);
        ArrayAdapter<CharSequence> adapterCategory = ArrayAdapter.createFromResource(
                this, R.array.categories, android.R.layout.simple_spinner_item);
        adapterCategory.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinnerCategory.setAdapter(adapterCategory);
        spinnerCategory.setOnItemSelectedListener(new MyOnItemSelectedListener());
        //TimelineView tlv = (TimelineView) findViewById(R.id.timeline_view);
        //ViewGroup container = (ViewGroup) findViewById(R.id.container);
        //container.addView(tlv);
    }
    public class MyOnItemSelectedListener implements OnItemSelectedListener {

        public void onItemSelected(AdapterView<?> parent,
            View view, int pos, long id) {
          Toast.makeText(parent.getContext(), "The selection is " +
              parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show();
        }

        public void onNothingSelected(AdapterView parent) {
          // Do nothing.
        }
    }
}

```

The lines commented out are stuff I've tried but didn't work either.

This code correctly puts 3 buttons and a spinner in a horizontal row across the top. But TimelineView fails to appear below them. I know that TimelineView is running because I can see debugging output in the LogCat that I put in.

I'm at my wits end and hope someone can shed some light. This seems like a common fundamental need and sure deserves a google tutorial.