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 ScrollView
inside 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 !