当前位置: 编程技术>移动开发
本页文章导读:
▪走马灯成效文字 走马灯效果文字
走马灯效果的代码,对TextView进行一下重写即可:
public class AutoScrollTextView extends TextView {
public final static String TAG = AutoScrollTextView.class.getSimpleName();
private float mTxtLength = 0f;// .........
▪ Gallery添小点效果实现 Gallery加小点效果实现
大家好:
心雨心今天又跟大家见面了
今天发布的是Gallery加小点效果实现
如图:
很多现在的android应用需要上图效果。gallery每次滑动一幅图片,小点要跟着发生变.........
▪ 怎么在Qt和Qml中发邮件 如何在Qt和Qml中发邮件
原创帖,转发请注明出处:http://thierry-xing.iteye.com/blog/1407453
有两个方法可以在Qt中发邮件:
1) 使用QtMobility API
#include <QMessage>
#include <QMessageService>
QMessageS.........
[1]走马灯成效文字
来源: 互联网 发布时间: 2014-02-18
走马灯效果文字
走马灯效果的代码,对TextView进行一下重写即可:
在Activity中调用一下init()方法即可.
布局文件还是贴一下吧:
今天补上一种系统自带的方法:
直接设置对应TextView的文本内容即可.
走马灯效果的代码,对TextView进行一下重写即可:
public class AutoScrollTextView extends TextView {
public final static String TAG = AutoScrollTextView.class.getSimpleName();
private float mTxtLength = 0f;// 文本长度
private float step = 0f;// 文字的横坐标
private float y = 10f;// 文字的纵坐标
private float mInitX = 0.0f;// 初始文字坐标
private float mEndX = 0.0f;// 判断文字左面坐标.
private Paint paint = null;// 绘图样式
private String text = "";// 文本内容
public AutoScrollTextView(Context context) {
super(context);
}
public AutoScrollTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public AutoScrollTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public void init() {
paint = getPaint();
text = getText().toString();
mTxtLength = paint.measureText(text);
step = mTxtLength;
mInitX = getLeft() + getLayoutParams().width + mTxtLength;
mEndX = getLeft() + getLayoutParams().width + mTxtLength * 2;
y = getTextSize() + getPaddingTop();
invalidate();
}
@Override
public void onDraw(Canvas canvas) {
canvas.drawText(text, mInitX - step, y, paint);
step += 1;
if (step > mEndX) {
step = mTxtLength;
}
invalidate();
}
}
在Activity中调用一下init()方法即可.
布局文件还是贴一下吧:
<com.ex.AutoScrollTextView
android:id="@+id/TextViewNotice"
android:layout_width="100dp"
android:layout_height="30dp"
android:layout_marginLeft="100dp"
android:layout_marginTop="100dp"
android:background="#EEE"
android:paddingTop="5dp"
android:text="浮动的文字欢饮你......."
android:textColor="#000"
android:textSize="15sp" >
</com.ex.AutoScrollTextView>
今天补上一种系统自带的方法:
<TextView
android:id="@+id/mTxt"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="100dp"
android:ellipsize="marquee"
android:fadingEdge="none"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:text="开放平台成网络淘金下一 ..."
android:textColor="@android:color/white"
android:textSize="18dip" />
直接设置对应TextView的文本内容即可.
[2] Gallery添小点效果实现
来源: 互联网 发布时间: 2014-02-18
Gallery加小点效果实现
大家好:
心雨心今天又跟大家见面了
今天发布的是Gallery加小点效果实现
如图:
很多现在的android应用需要上图效果。gallery每次滑动一幅图片,小点要跟着发生变化。
自己写的小demo,请参考!
[3] 怎么在Qt和Qml中发邮件
来源: 互联网 发布时间: 2014-02-18
如何在Qt和Qml中发邮件
原创帖,转发请注明出处:http://thierry-xing.iteye.com/blog/1407453
有两个方法可以在Qt中发邮件:
1) 使用QtMobility API
#include <QMessage>
#include <QMessageService>
QMessageService* msgAction = new QMessageService(this);
QMessage msg;
msg.setType(QMessage::Email);
msg.setTo(QMessageAddress(QMessageAddress::Email,"abc@abc.com"));
msg.setSubject("邮件标题");
msg.setBody("邮件内容");
QStringList attachments;
attachments.append(":/res/icon.png");
msg.appendAttachments(attachments);
//Send email message
qDebug()<<"Sending Status = "<<msgAction->send(msg);
2) 使用默认邮件客户端
QDesktopServices:openUrl(QUrl(tr("mailto:abc@abc.com?subject=邮件标题&body=邮件内容")));
qml中这样使用:
Qt.openUrlExternally("mailto:abc@abc.com?subject=邮件标题&body=邮件内容)
最新技术文章: