【WD】IAPP代码大全[第二期]

IAPP   © 文章版权由 admin 解释,禁止匿名转载

#楼主# 2021-11-20

又到了第二期

#【WD】IAPP实用代码大全[第一期]#
第一期在这

那开始吧

建议开始楼主模式
[真棒]

【WD】原创

第一个
发送邮件
import "android.content.Intent"

local i = Intent(Intent.ACTION_SEND)
i.setType("message/rfc822")--发送内容的类型
i.putExtra(Intent.EXTRA_EMAIL, {"2113075983@.com"})--可发送多个收件人
i.putExtra(Intent.EXTRA_SUBJECT,"Feedback")--邮件的主题
i.putExtra(Intent.EXTRA_TEXT,"Content")--邮件的内容
activity.startActivity(Intent.createChooser(i, "Choice"))--创建应用选择
第二个
更改对话框标题,消息与按钮的颜色
4楼
无奈的盛夏 2021-11-20
顶。。前排有凯币吗
import "android.content.Intent"

local i = Intent(Intent.ACTION_SEND)
i.setType("message/rfc822")--发送内容的类型
i.putExtra(Intent.EXTRA_EMAIL, {"2113075983@.com"})--可发送多个收件人
i.putExtra(Intent.EXTRA_SUBJECT,"Feedback")--邮件的主题
i.putExtra(Intent.EXTRA_TEXT,"Content")--邮件的内容
activity.startActivity(Intent.createChooser(i, "Choice"))--创建应用选择
第三个
使用TTS播报语音
import "android.speech.tts.*"

local mTextSpeech = TextToSpeech(activity, TextToSpeech.OnInitListener{
onInit=function(status)
--如果装载TTS成功
if (status == TextToSpeech.SUCCESS)
result = mTextSpeech.setLanguage(Locale.CHINESE);
--[[LANG_MISSING_DATA-->语言的数据丢失
LANG_NOT_SUPPORTED-->语言不支持]]
if (result == TextToSpeech.LANG_MISSING_DATA or result == TextToSpeech.LANG_NOT_SUPPORTED)
--不支持中文
print("您的手机不支持中文语音播报功能。");
result = mTextSpeech.setLanguage(Locale.ENGLISH);
if (result == TextToSpeech.LANG_MISSING_DATA or result == TextToSpeech.LANG_NOT_SUPPORTED)
--不支持中文和英文
print("您的手机不支持语音播报功能。");
else
--不支持中文但支持英文
--语调,1.0默认
mTextSpeech.setPitch(1);
--语速,1.0默认
mTextSpeech.setSpeechRate(1);
mTextSpeech.speak("Hello,World!", TextToSpeech.QUEUE_FLUSH, nil);
end
else
--支持中文
--语调,1.0默认
mTextSpeech.setPitch(1);
--语速,1.0默认
mTextSpeech.setSpeechRate(1);
mTextSpeech.speak("你好,世界!", TextToSpeech.QUEUE_FLUSH, nil);
end
end
end
})
第四个
关于textView的字体大小
activity.setContentView(loadlayout({
LinearLayout,
orientation="vertical",
{
TextView,
text="关于textSize与TextSize的单位问题",
layout_height="56dp",
textSize="18dp";
gravity="center";
paddingLeft="18dp";
textColor=文字色;
maxLines=1;
},
{
ScrollView,
layout_width="fill",
layout_height="fill",
{
LinearLayout,
orientation="vertical",
layout_width="fill",
layout_height="fill",
padding="8dp";
{
TextView,
text="textSize 14dp Hello World",
textColor=文字色;
textSize="14dp";
},
{
TextView,
text="textSize 14sp Hello World",
textColor=文字色;
textSize="14sp";
},
{
TextView,
text="textSize 14 Hello World",
textColor=文字色;
textSize=14;
},
{
TextView,
text="TextSize 14dp Hello World",
textColor=文字色;
TextSize="14dp";
},
{
TextView,
text="TextSize 14sp Hello World",
textColor=文字色;
TextSize="14sp";
},
{
TextView,
text="TextSize 14 Hello World",
textColor=文字色;
TextSize=14;
},
{
TextView,
text="
通过上面的对比我们可以看到,当使用textSize时,dp、sp和无单位的显示效果是相同的;当使用TextSize时,dp和sp会变成特大,而不带单位则和上面的textSize显示效果相同。

在我们的工程中最好使用textSize+dp,这样在大部分机型都不会出现布局错位及字体特大的情况。",
textColor=文字色;
textSize=14;
},
},
};
}))
第五个
获取字符串MD5

评论

登录后才可发表内容
  • 主题

    863

  • 帖子

    39585

  • 关注者

    0

Copyright © 2019 凯特网.   Powered by HYBBS 2.3.4  

Runtime:0.0500s Mem:2039Kb