Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/188.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
有人可以使用Android 3D旋转木马的文本视图吗?_Android_Reflection_Android Layout_Textview_Carousel - Fatal编程技术网

有人可以使用Android 3D旋转木马的文本视图吗?

有人可以使用Android 3D旋转木马的文本视图吗?,android,reflection,android-layout,textview,carousel,Android,Reflection,Android Layout,Textview,Carousel,我们这里有Android 3D旋转木马: 我的问题是:我想在图像和反射之间做一个文本标签 我怎么做 请帮帮我我找到了一个答案:使用旋转木马框架 public class CarouselFrame extends FrameLayout implements Comparable<CarouselFrame> { private int index; private float currentAngle; private float x; private float y; priv

我们这里有Android 3D旋转木马:

我的问题是:我想在图像和反射之间做一个文本标签

我怎么做


请帮帮我

我找到了一个答案:使用旋转木马框架

public class CarouselFrame extends FrameLayout implements Comparable<CarouselFrame> {

private int index;
private float currentAngle;
private float x;
private float y;
private float z;
private boolean drawn;

private ImageView image;
private TextView txt;

public CarouselFrame(Context context) {
    this(context, null, 0);
}   

public CarouselFrame(Context context, AttributeSet attrs) {
    this(context, attrs, 0);
}

public CarouselFrame(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    image = new ImageView(context);
    this.addView(image, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
    txt = new TextView(context);
    this.addView(txt, new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT));
}

public void setImageBitmap(Bitmap img){
    image.setImageBitmap(img);
}

public void setText(String text){
    txt.setText(text);
}


public void setIndex(int index) {
    this.index = index;
}

public int getIndex() {
    return index;
}


public void setCurrentAngle(float currentAngle) {
    this.currentAngle = currentAngle;
}

public float getCurrentAngle() {
    return currentAngle;
}

public int compareTo(CarouselFrame another) {
    return (int)(another.z - this.z);
}

public void setX(float x) {
    this.x = x;
}

public float getX() {
    return x;
}

public void setY(float y) {
    this.y = y;
}

public float getY() {
    return y;
}

public void setZ(float z) {
    this.z = z;
}

public float getZ() {
    return z;
}

public void setDrawn(boolean drawn) {
    this.drawn = drawn;
}

public boolean isDrawn() {
    return drawn;
}
公共类CarouselFrame扩展FrameLayout{
私有整数索引;
私人浮动角度;
私人浮动x;
私人游船;
私有浮动z;
私有布尔绘制;
私有图像查看图像;
私有文本视图;
公共旋转框架(上下文){
这个(上下文,null,0);
}   
公共旋转框架(上下文、属性集属性){
这(上下文,属性,0);
}
公共旋转框架(上下文、属性集属性、int defStyle){
超级(上下文、属性、定义样式);
图像=新图像视图(上下文);
this.addView(图像,新的LayoutParams(ViewGroup.LayoutParams.WRAP_内容,
ViewGroup.LayoutParams.WRAP_CONTENT);
txt=新文本视图(上下文);
此.addView(txt,新的LayoutParams(ViewGroup.LayoutParams.WRAP_内容,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
公共void setImageBitmap(位图img){
设置图像位图(img);
}
公共void setText(字符串文本){
txt.setText(文本);
}
公共void集合索引(int索引){
这个指数=指数;
}
public int getIndex(){
收益指数;
}
公共无效设置currentAngle(浮动currentAngle){
此.currentAngle=currentAngle;
}
公共浮点getCurrentAngle(){
回流角;
}
公共int比较(转盘框架另一个){
return(int)(另一个.z-这个.z);
}
公共无效集合x(浮动x){
这个.x=x;
}
公共浮点getX(){
返回x;
}
公共无效setY(浮动y){
这个。y=y;
}
公共浮球{
返回y;
}
公共无效集合z(浮动z){
这个。z=z;
}
公共浮动getZ(){
返回z;
}
公共无效集合绘制(布尔绘制){
this.draw=draw;
}
公共布尔值isDrawn(){
回款;
}

}

这对我也有帮助。。但是在将带有文本的图像放在屏幕中央后,旋转木马不会出现在屏幕中央。。请告诉我应该在哪里编辑,编辑什么