0

I am using this 3D library : https://github.com/Rajawali/Rajawali

and I am using org.rajawali3d.surface.RajawaliTextureView which extends a TextureView.

I'd like to place it in a ScrollViewinside my layout XML file, but attempting to do so fails : the opengl-rendered content is not visible.

I can see the content if I do not use it inside a scrollview.

This how my XML looks like :

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" android:id="@+id/container">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:id="@+id/earth_container">

        <org.rajawali3d.surface.RajawaliTextureView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/earth"/>

        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="animate"
            android:id="@+id/animate"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"
            android:layout_gravity="center_horizontal" />

    </RelativeLayout>

</ScrollView>

And this is the content of my Activity :

public class Activity3D extends AppCompatActivity {
    private Renderer renderer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_3d);

        final RelativeLayout container = (RelativeLayout) findViewById(R.id.earth_container);

        final RajawaliTextureView surface = (RajawaliTextureView) findViewById(R.id.earth);
        surface.setFrameRate(60.0);
        surface.setRenderMode(IRajawaliSurface.RENDERMODE_WHEN_DIRTY);
        renderer = new Renderer(this);
        surface.setSurfaceRenderer(renderer);


        findViewById(R.id.animate).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                YoYo.with(Techniques.SlideInDown)
                        .duration(2000)
                        .playOn(container);
            }
        });
    }
}

For more details, I followed this tutorial to try the aforementioned library : http://www.clintonmedbery.com/?p=59 which works just fine, that is if I don't use a ScrollView.

I know that SurfaceView does not work well with animation and movement (like scrolling) that is why I am using a TextureView. But what am I doing wrong ? Why can't I see the content of my TextureView ? As I said, it works just fine without using a ScrollView.

Thanks for the help !

genpfault
  • 51,148
  • 11
  • 85
  • 139
Mackovich
  • 3,319
  • 6
  • 35
  • 73
  • I think you have to submit such problem on GitHub who created this library/sdk. – Haresh Chhelana Dec 09 '15 at 08:43
  • So you mean that it should work as I am trying to do, which would also mean that I might have identified a bug in the library ? – Mackovich Dec 09 '15 at 08:46
  • Check out my answer here: http://stackoverflow.com/a/12524612/1306012 I describe how you can add buttons on a relative layout. – Bruno Bieri Dec 09 '15 at 13:59
  • @BrunoBieri thank you but your answer if for simple based Android XML Layout. What I am attempting to do is implement opengl View inside a ScrollView. Please read my post for more details. Thanks ! – Mackovich Dec 10 '15 at 08:16

0 Answers0