有人可以在 Android 3D Carousel 中使用文本视图吗?

发布于 2024-11-01 19:16:56 字数 231 浏览 0 评论 0原文

我们这里有 Android 3D 轮播: http://www.codeproject.com/KB/android/ androcarousel.aspx

我的问题是:我想在图像和反射之间制作文本标签?

我该怎么做?

请帮助我

We have Android 3D Carousel here: http://www.codeproject.com/KB/android/androcarousel.aspx

There my problem is that: i want to make text label between the image and the reflection ?

how can i do it?

Help me please

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苹果你个爱泡泡 2024-11-08 19:16:56

我找到了答案:使用 CarouselFrame

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;
}

}

I found the anwser: Use CarouselFrame

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;
}

}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文