我希望SurfaceView
必须出现在选项下拉列表[编辑维度等]后面。当我点击Activity
上的选项时,SurfaceView
应显示在下拉列表后面。
请检查以下链接中的图片,您将在选项下拉列表后面找到surfaceview未出现的问题。你很容易理解这些问题。
请帮帮我怎么做。
提前致谢
图片:
布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="vertical"
android:weightSum="1" >
<FrameLayout
android:id="@+id/topLinearLayout"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:background="@drawable/bar" >
<ImageView
android:id="@+id/new_quote_imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/new_quote_bar" />
<TextView
android:id="@+id/new_quote"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="@string/new_quote"
android:textColor="@android:color/white"
android:textSize="18sp" />
<TextView
android:id="@+id/optionsTextView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:layout_marginRight="15dip"
android:drawableRight="@drawable/icn_dropdown_open"
android:gravity="center"
android:text="@string/options"
android:textColor="@android:color/white"
android:textSize="18sp" />
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<FrameLayout
android:id="@+id/topFrameLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<!-- ImageView for the product -->
<ImageView
android:id="@+id/photoImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.amplimesh.renderer.RendererView
android:id="@+id/renderer_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"/>
</FrameLayout>
<ScrollView
android:id="@+id/dropDownScrollView"
android:layout_width="300dip"
android:layout_height="wrap_content"
android:visibility="gone">
<LinearLayout
android:id="@+id/dropDownList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/dropdown_background"
android:orientation="vertical"
android:paddingBottom="20dip"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:visibility="gone" >
<LinearLayout
android:id="@+id/editDimensionLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:orientation="horizontal"
android:weightSum="1" >
<ImageView
android:id="@+id/leftImage"
android:layout_width="30dip"
android:layout_height="30dip"
android:background="@drawable/left_image_drop_down" />
<TextView
android:id="@+id/dimensionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:gravity="center_vertical"
android:text="@string/edit_dimension"
android:textColor="@android:color/black"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/editDimensionValueLayout"
android:layout_width="match_parent"
android:layout_height="270dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="10dip"
android:background="@drawable/edit_dimension_layout"
android:orientation="vertical"
android:visibility="gone" >
<TextView
android:id="@+id/heightTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dip"
android:layout_marginTop="10dip"
android:gravity="center_vertical"
android:text="@string/height"
android:textColor="@android:color/black"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/heightEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:maxWidth="180dip"
android:minWidth="150dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:gravity="center"
android:text="@string/cm"
android:textColor="@android:color/black"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/widthTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="12dip"
android:layout_marginTop="10dip"
android:gravity="center_vertical"
android:text="@string/width"
android:textColor="@android:color/black"
android:textSize="16sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<EditText
android:id="@+id/widthEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:maxWidth="180dip"
android:minWidth="150dip" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dip"
android:gravity="center"
android:text="@string/cm"
android:textColor="@android:color/black"
android:textSize="14sp" />
</LinearLayout>
<Button
android:id="@+id/saveButton"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:background="@drawable/button_background"
android:gravity="center"
android:text="@string/save"
android:textColor="@android:color/white" />
</LinearLayout>
<LinearLayout
android:id="@+id/pickColorLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="20dip"
android:orientation="horizontal"
android:weightSum="1" >
<ImageView
android:id="@+id/leftImage"
android:layout_width="30dip"
android:layout_height="30dip"
android:background="@drawable/left_image_drop_down" />
<TextView
android:id="@+id/pickColorTextView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dip"
android:gravity="center_vertical"
android:text="@string/pick_colour"
android:textColor="@android:color/black"
android:textSize="18sp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/pickColourValueLayout"
android:layout_width="match_parent"
android:layout_height="330dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="10dip"
android:background="@drawable/edit_dimension_layout"
android:visibility="gone" >
<ImageButton
android:id="@+id/firstColour"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:background="@drawable/first_colour" />
<ImageButton
android:id="@+id/secondColour"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/firstColour"
android:layout_marginRight="10dip"
android:background="@drawable/tenth_colour" />
<ImageButton
android:id="@+id/thirdColour"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_alignLeft="@id/firstColour"
android:layout_below="@id/firstColour"
android:layout_marginTop="15dip"
android:background="@drawable/second_colour" />
<ImageButton
android:id="@+id/fourthColour"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/thirdColour"
android:layout_marginRight="10dip"
android:background="@drawable/ninth_colour" />
<ImageButton
android:id="@+id/fifthColour"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_alignLeft="@id/firstColour"
android:layout_below="@id/thirdColour"
android:layout_marginTop="15dip"
android:background="@drawable/third_colour" />
<ImageButton
android:id="@+id/sixthColour"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/fifthColour"
android:layout_marginRight="10dip"
android:background="@drawable/eight_colour" />
<ImageButton
android:id="@+id/seventhColour"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_alignLeft="@id/firstColour"
android:layout_below="@id/fifthColour"
android:layout_marginTop="15dip"
android:background="@drawable/fourth_colour" />
<ImageButton
android:id="@+id/eightColour"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/seventhColour"
android:layout_marginRight="10dip"
android:background="@drawable/seventh_colour" />
<ImageButton
android:id="@+id/ninthColour"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_alignLeft="@id/firstColour"
android:layout_below="@id/seventhColour"
android:layout_marginTop="15dip"
android:background="@drawable/fifth_colour" />
<ImageButton
android:id="@+id/tenthColour"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_alignParentRight="true"
android:layout_alignTop="@id/ninthColour"
android:layout_marginRight="10dip"
android:background="@drawable/sixth_colour" />
</RelativeLayout>
<LinearLayout
android:id="@+id/addMeshLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="20dip"
android:orientation="horizontal"
android:weightSum="1" >
<ImageView
android:id="@+id/leftImage"
android:layout_width="30dip"
android:layout_height="30dip"
android:background="@drawable/left_image_drop_down" />
<TextView
android:id="@+id/pickColorTextView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dip"
android:gravity="center_vertical"
android:text="@string/add_mesh"
android:textColor="@android:color/black"
android:textSize="18sp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/addMeshContentLayout"
android:layout_width="match_parent"
android:layout_height="200dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="10dip"
android:background="@drawable/edit_dimension_layout"
android:visibility="gone" >
<Button
android:id="@+id/firstAddButton"
android:layout_width="60dip"
android:layout_height="45dip"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:background="@drawable/add_button_background"
android:text="@string/add"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/securaMeshTextView"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_alignTop="@id/firstAddButton"
android:layout_marginLeft="15dip"
android:layout_marginRight="10dip"
android:layout_toRightOf="@id/firstAddButton"
android:gravity="center_vertical"
android:text="@string/securamesh"
android:textColor="@android:color/black" />
<Button
android:id="@+id/secondAddButton"
android:layout_width="60dip"
android:layout_height="45dip"
android:layout_alignLeft="@id/firstAddButton"
android:layout_below="@id/firstAddButton"
android:layout_marginTop="15dip"
android:background="@drawable/add_button_background"
android:text="@string/add"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/supameshTextView"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_alignTop="@id/secondAddButton"
android:layout_marginLeft="15dip"
android:layout_marginRight="10dip"
android:layout_toRightOf="@id/secondAddButton"
android:gravity="center_vertical"
android:text="@string/supamesh"
android:textColor="@android:color/black" />
<Button
android:id="@+id/removeButton"
android:layout_width="100dip"
android:layout_height="45dip"
android:layout_below="@id/secondAddButton"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dip"
android:background="@drawable/button_background"
android:text="@string/remove"
android:textColor="@android:color/white" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</FrameLayout>
</LinearLayout>
代码:
package com.amplimesh.renderer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;
import android.content.Context;
import android.graphics.PixelFormat;
import android.opengl.GLSurfaceView;
import android.opengl.GLU;
import android.util.AttributeSet;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import com.amplimesh.AddProductsActivity;
import com.amplimesh.models.ObjModel;
import com.amplimesh.util.MathHelper;
import com.amplimesh.util.Point3;
public class RendererView extends GLSurfaceView {
public static final int GRID_SIZE=8;
private Context mContext;
private Renderer mRenderer;
private TouchHelper mTouchHelper;
float mViewWidth, mViewHeight;
ObjModel mModel;
Point3 mOrigin;
Point3 mRotate;
Point3 mCamera;
FloatBuffer mGrid;
int mGridSize;
public static String objName = "";
public static String textureFileName = "";
public RendererView(Context context) {
this(context,null);
}
public RendererView(Context context, AttributeSet attrs) {
super(context,attrs);
mContext = context;
try{
mModel = ObjModel.loadFromStream(mContext.getAssets().open(objName), textureFileName);
} catch (java.io.IOException e) {
Log.v("DemoRendererView", "loading model: "+e);
}
mOrigin = new Point3(0f,0f,0f);
mRotate = new Point3(0f,0f,0f);
mCamera = new Point3(0f,3f,3.9f);
mTouchHelper = new TouchHelper(context);
}
public void start() {
mRenderer = new Renderer();
setEGLContextClientVersion(1);
setRenderer(mRenderer);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
return mTouchHelper.onTouchEvent(ev);
}
private void drag_xy(float dx, float dy) {
mOrigin.x += (dx/mViewWidth)*mGridSize;
mOrigin.y -= (dy/mViewHeight)*mGridSize;
float half = mGridSize/2;
mOrigin.minmax(-half+.5f,-half+.5f,-half+.5f,half-.5f,half-.5f,half-.5f);
}
private void drag_xz(float dx, float dy) {
mOrigin.x += (dx/mViewWidth)*mGridSize;
mOrigin.z += (dy/mViewHeight)*mGridSize;
float half = mGridSize/2;
mOrigin.minmax(-half+.5f,-half+.5f,-half+.5f,half-.5f,half-.5f,half-.5f);
}
private class TouchHelper extends GestureDetector.SimpleOnGestureListener {
GestureDetector gesture;
int ptr1_id=-1, ptr2_id=-1;
float last_x=-1, last_y=-1;
public TouchHelper(Context context) {
gesture = new GestureDetector(context, this);
}
@Override
public boolean onDoubleTap(MotionEvent ev) {
if (mRotationFinal != -1)
return true;
int index = ev.getActionIndex();
float x = ev.getX(index);
float y = ev.getY(index);
int col = (int)(x / mViewWidth * 3);
int row = (int)(y / mViewHeight * 3);
Log.v("ObjDem", "col,row:"+col+","+row);
if (col == 0 && row == 0) {
mRotationAxis = Z_AXIS;
mRotationFinal = mRotate.z + 90;
mRotationDelta = 1;
}
else
if (col == 0 && row == 1) {
mRotationAxis = Y_AXIS;
mRotationFinal = mRotate.y - 90;
mRotationDelta = -1;
}
else
if (col == 1 && row == 0) {
mRotationAxis = X_AXIS;
mRotationFinal = mRotate.x - 90;
mRotationDelta = -1;
}
else
if (col == 1 && row == 2) {
mRotationAxis = X_AXIS;
mRotationFinal = mRotate.x + 90;
mRotationDelta = 1;
}
else
if (col == 2 && row == 1) {
mRotationAxis = Y_AXIS;
mRotationFinal = mRotate.y + 90;
mRotationDelta = 1;
}
else
if (col == 2 && row == 2) {
mRotationAxis = Z_AXIS;
mRotationFinal = mRotate.z - 90;
mRotationDelta = -1;
}
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float vel_x, float vel_y) {
float angle = MathHelper.angle_of_vector(vel_x, vel_y);
Log.v("ObjDemo", "vel: "+vel_x+","+vel_y+" = "+angle);
return true;
}
public boolean onTouchEvent(MotionEvent ev) {
if(AddProductsActivity.optionFlag) {
return false;
}
if (gesture.onTouchEvent(ev)) {
ptr1_id = -1;
ptr2_id = -1;
last_x = -1f;
last_y = -1f;
return true;
}
int action = ev.getActionMasked();
int index = ev.getActionIndex();
int id = ev.getPointerId(index);
int count = ev.getPointerCount();
switch (action) {
case MotionEvent.ACTION_DOWN:
ptr1_id = id;
break;
case MotionEvent.ACTION_POINTER_DOWN:
ptr2_id = id;
break;
case MotionEvent.ACTION_POINTER_UP:
ptr2_id = -1;
break;
case MotionEvent.ACTION_UP:
ptr1_id = -1;
last_x = -1;
last_y = -1;
break;
case MotionEvent.ACTION_MOVE:
float x,y;
if (count >= 2) {
x = ev.getX(index);
y = ev.getY(index);
if (last_x != -1)
drag_xz(x - last_x, y - last_y);
}
else {
x = ev.getX(index);
y = ev.getY(index);
if (last_x != -1)
drag_xy(x - last_x, y - last_y);
}
last_x = x;
last_y = y;
break;
}
return true;
}
}
public final static int NONE=-1;
public final static int X_AXIS=0;
public final static int Y_AXIS=1;
public final static int Z_AXIS=2;
float mRotationFinal=-1f;
float mRotationDelta=0f;
int mRotationAxis=-1;
private void tick() {
if (mRotationFinal != -1) {
float close = Math.abs(mRotationDelta*2);
switch (mRotationAxis) {
case X_AXIS:
mRotate.x += mRotationDelta;
if (Math.abs(mRotationFinal - mRotate.x) <= close) {
mRotate.x = mRotationFinal;
mRotationFinal=-1;
}
break;
case Y_AXIS:
mRotate.y += mRotationDelta;
if (Math.abs(mRotationFinal - mRotate.y) <= close) {
mRotate.y = mRotationFinal;
mRotationFinal=-1;
}
break;
case Z_AXIS:
mRotate.z += mRotationDelta;
if (Math.abs(mRotationFinal - mRotate.z) <= close) {
mRotate.z = mRotationFinal;
mRotationFinal=-1;
}
break;
}
//mRotate.minmax(-360,-360,-360, 360,360,360);
}
}
private class Renderer implements GLSurfaceView.Renderer {
public Renderer() {
setAlpha(0);
setZOrderOnTop(false);
}
public void onSurfaceCreated(GL10 gl, EGLConfig config)
{
gl.glClearColor(0f,0f,0f, 0.5f);
gl.glEnable(GL10.GL_DEPTH_TEST);
gl.glDepthFunc(GL10.GL_LEQUAL);
gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
gl.glEnable(GL10.GL_TEXTURE_2D);
gl.glShadeModel(GL10.GL_SMOOTH);
build_grid(GRID_SIZE);
if(mModel != null)
mModel.bindTextures(mContext, gl);
}
public void onSurfaceChanged(GL10 gl, int w, int h) {
mViewWidth = (float)w;
mViewHeight = (float)h;
gl.glViewport(0,0,w,h);
gl.glMatrixMode(GL10.GL_PROJECTION);
gl.glLoadIdentity();
GLU.gluPerspective(gl, 60.0f, mViewWidth/mViewHeight, 0.1f, 100f);
gl.glMatrixMode(GL10.GL_MODELVIEW);
gl.glLoadIdentity();
}
public void onDrawFrame(GL10 gl) {
tick();
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
gl.glPushMatrix();
//position camera
GLU.gluLookAt(gl, mCamera.x,mCamera.y,mCamera.z, mOrigin.x,mOrigin.y,mOrigin.z, 0f,1f,0f);
//draw_grid
draw_grid(gl);
//draw_model
gl.glPushMatrix();
gl.glTranslatef(mOrigin.x, mOrigin.y, 2);
gl.glRotatef(mRotate.x, 1f, 0f, 0f);
gl.glRotatef(mRotate.y, 0f, 1f, 0f);
gl.glRotatef(mRotate.z, 0f, 0f, 1f);
mModel.draw(gl);
gl.glPopMatrix();
gl.glPopMatrix();
}
private void build_grid(int GRID_SIZE) {
float i;
float half = GRID_SIZE/2f;
mGridSize = GRID_SIZE;
ByteBuffer tBuf = ByteBuffer.allocateDirect((GRID_SIZE+1)*12*3 * 4);
tBuf.order(ByteOrder.nativeOrder());
mGrid = tBuf.asFloatBuffer();
for (i=-half; i <= +half; i++) {
mGrid.put(i); mGrid.put(-half); mGrid.put(+half);
mGrid.put(i); mGrid.put(-half); mGrid.put(-half);
mGrid.put(i); mGrid.put(+half); mGrid.put(-half);
mGrid.put(i); mGrid.put(+half); mGrid.put(+half);
mGrid.put(-half); mGrid.put(i); mGrid.put(+half);
mGrid.put(-half); mGrid.put(i); mGrid.put(-half);
mGrid.put(+half); mGrid.put(i); mGrid.put(-half);
mGrid.put(+half); mGrid.put(i); mGrid.put(+half);
mGrid.put(-half); mGrid.put(+half); mGrid.put(i);
mGrid.put(-half); mGrid.put(-half); mGrid.put(i);
mGrid.put(+half); mGrid.put(-half); mGrid.put(i);
mGrid.put(+half); mGrid.put(+half); mGrid.put(i);
}
mGrid.rewind();
}
public void draw_grid(GL10 gl) {
gl.glPushMatrix();
int ofs=0;
int i;
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mGrid);
for (i=0; i <= mGridSize*3; i++)
{
gl.glDrawArrays(GL10.GL_LINE_LOOP, ofs, 4);
ofs+=4;
}
gl.glPopMatrix();
}
}
}
package com.amplimesh.models;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.util.ArrayList;
import java.util.StringTokenizer;
import javax.microedition.khronos.opengles.GL10;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.opengl.GLUtils;
import android.util.Log;
import com.amplimesh.util.Point3;
public class ObjModel {
public void bindTextures(Context context, GL10 gl) {
Bitmap bitmap;
try {
InputStream is = context.getAssets().open("textures/"+mTextureName);
bitmap = BitmapFactory.decodeStream(is);
if (bitmap == null) {
Log.v("ObjModel", "err loading bitmap!");
}
} catch (java.io.IOException e) {
Log.v("ObjModel", "err loading tex: "+e.toString());
return;
}
mTextures = new int[1];
gl.glGenTextures(1, mTextures, 0);
gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextures[0]);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
bitmap.recycle();
}
public void draw(GL10 gl) {
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
for (Model model : mModels) {
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, model.v);
if (model.vt != null && mTextures != null) {
gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextures[0]);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, model.vt);
}
if (model.vn != null) {
gl.glNormalPointer(GL10.GL_FLOAT, 0, model.vn);
}
gl.glDrawArrays(GL10.GL_TRIANGLES, 0, model.v_size);
}
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
}
public static ObjModel loadFromStream(InputStream is, String texture_name) throws IOException {
ObjModel obj = ObjLoader.loadFromStream(is);
obj.mTextureName = texture_name;
return obj;
}
private Model mModels[];
private int mTextures[];
private String mTextureName;
}
答案 0 :(得分:0)
在您的代码中设置ZOrderOnTop(true);我认为这解释了一切,它导致矩形绘制在顶部,这就是为什么你看到这样,你应该设置为假
setZOrderOnTop(false);
并且在您的代码中,您应该声明您的选项下拉列表并在其上调用
...
yourDropDownView.bringToFront();