一、关闭之前的helloworld程序
点击file,然后close project,就完成关闭了。
二、创建一个新的happybirthday程序
三、下面开始整个APP的修改
1、如何查看Androidstudio中activity_main.xml的源代码,在图中 灰色部分现在是Design,点到code就会出现activity_main_xml的代码了。
2、进行如下代码的修改。把根布局改成相对布局 androidx.constraintlayout.widget.ConstraintLayout改为RelativeLayout
把多余的代码删除掉 ,并将文本内容改为android:text="祝你生日快乐!"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent"
并可以修改文字的大小,颜色,添加边框.。代码如下:
3、在左侧目录下,res是存放资源文件的(图片放进来);java是存放java代码的;mainfests是存放配置文件的。因此将图片复制在最侧res目录下。
4、将代码补充完整
代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="祝你生日快乐!"
android:textColor="@android:color/holo_orange_light"
android:textSize="22dp"
/>
<ImageView
android:layout_centerInParent="true"
android:src="@drawable/img"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
5、最后的效果如图所示
6、可在手机中看到happybirthday的程序包,打开便是上面的画面。
用微信做生日贺卡送给朋友微信小程序怎么制作生日祝福贺卡
手机软件1 进入手机微信搜索并进入心意贺卡小程序选择生日
微信制作生日贺卡
微信心意贺卡diy小程序小程序网
微信小程序制作生日祝福贺卡的方法介绍
怎样设计微信生日贺卡 设计微信贺卡
如下我就为大家收集了微信制作生日贺卡欢迎阅读
手机微信生日贺卡制作
微信小程序怎么制作生日祝福贺卡
此外这款小程序还是很跟时代.如何制作一张给妈妈的贺卡呢
最美贺卡微信小程序v2.
生日快乐程序微信生日快乐贺卡微信生日贺卡小程序在线制作
是生日祝福还是红包贺卡其实都应该通过微信而现在有了小程序后
微信怎么制作生日祝福贺卡微信制作生日祝福贺卡教程
微信心意贺卡diy小程序小程序网
#include <iostream>#include <stdlib.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <windows.h>
using namespace std
void color(int a)//颜色函数
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a)
}
int main(){
char a
color(12)
cout <<"Do you want to see your BIRTHDAY CARD( Input y or n )?" <<endl
color(15)
cin >>a
color(12)
if ( a=='y' ){
cout <<"Ok, you will see your birthday card soon!" <<endl
} else {
cout <<"That's OK, but happy birthday to you!" <<endl
return 0
}
Sleep(1000)
color(268)
cout <<"HAPPY "
color(270)
cout <<"BRITHDAY "
color(9)
cout <<"TO "
color(10)
cout <<"YOU!" <<endl
color(0)
Sleep(500)
cout <<" "
color(236)
cout <<"********"
color(0)
cout <<" "
color(236)
cout <<"********" <<endl
Sleep(500)
color(0)
cout <<" "
color(236)
cout <<"************"
color(0)
cout <<" "
color(236)
cout <<"************" <<endl
Sleep(500)
cout <<"****************************" <<endl
Sleep(500)
cout <<"****************************" <<endl
Sleep(500)
cout <<"****************************" <<endl
Sleep(500)
color(0)
cout <<" "
color(236)
cout <<"************************" <<endl
Sleep(500)
color(0)
cout <<""
color(236)
cout <<"********************" <<endl
Sleep(500)
color(0)
cout <<" "
color(236)
cout <<"****************" <<endl
Sleep(500)
color(0)
cout <<""
color(236)
cout <<"************" <<endl
Sleep(500)
color(0)
cout <<" "
color(236)
cout <<"********" <<endl
Sleep(500)
color(0)
cout <<""
color(236)
cout <<"****" <<endl
Sleep(500)
char c[55] = { 'T' ,'h' ,'a' ,'n' ,'k', ' ' ,'y' ,'o' ,'u', ' ' ,'f' ,'o' ,'r', ' ' ,'l' ,'o' ,'o' ,'k' ,'i' ,'n' ,'g', ' ' ,'a' ,'f' ,'t' ,'e' ,'r', 's', ' ' ,'m' ,'e', ' ' ,'f' ,'o' ,'r', ' ' ,'e' ,'l' ,'e' ,'v' ,'e' ,'n', ' ' ,'y' ,'e' ,'a' ,'r' ,'s', ',', ' ' ,'m' ,'o' ,'m' ,'!', '0' }
for ( int i=0i<=53i++ ){
color( ( i+1 ) % 15 + 1 )
cout <<c[i]
}
cout <<endl
Sleep(10000)
char d[12] = { 'I', ' ', 'l', 'o', 'v', 'e', ' ', 'y', 'o', 'u', '!', '0' }
int count = 0
for ( int j=1j<=1000j++ ){
count++
for ( int i=0i<=10i++ ){
color(i+1)
cout <<d[i]
}
cout <<" "
}
cout <<endl
cout <<"What present do you want(Input the number of the present)?" <<endl
char e
cout <<"A clothes(A)???(B)Lipstick(C)" <<endl
cin >>e
srand((unsigned)time(NULL))
for ( int i=1i<=20i++ ){
system( "cls" )
int s = 1
int tmp = rand()%4
switch( tmp ){
case 0:{
tmp++
break
}
case 1:{
color(rand()%15+1)
s++
cout <<" # " <<endl
color(rand()%15+1)
s++
cout <<"# #" <<endl
color(rand()%15+1)
s++
cout <<" # # " <<endl
color(rand()%15+1)
s++
cout <<" ####### " <<endl
color(rand()%15+1)
s++
cout <<" # # " <<endl
color(rand()%15+1)
s++
cout <<"# #" <<endl
color(rand()%15+1)
s++
cout <<" # # " <<endl
break
}
case 2:{
color(rand()%15+1)
s++
cout <<"######### " <<endl
color(rand()%15+1)
s++
cout <<"## " <<endl
color(rand()%15+1)
s++
cout <<"## " <<endl
color(rand()%15+1)
s++
cout <<"######### " <<endl
color(rand()%15+1)
s++
cout <<"## " <<endl
color(rand()%15+1)
s++
cout <<"## " <<endl
color(rand()%15+1)
s++
cout <<"######### " <<endl
break
}
case 3:{
color(rand()%15+1)
s++
cout <<" ######### " <<endl
color(rand()%15+1)
s++
cout <<"# " <<endl
color(rand()%15+1)
s++
cout <<"# " <<endl
color(rand()%15+1)
s++
cout <<"# " <<endl
color(rand()%15+1)
s++
cout <<"# " <<endl
color(rand()%15+1)
s++
cout <<"# " <<endl
color(rand()%15+1)
s++
cout <<" ######## " <<endl
break
}
}
Sleep(i*50)
}
system ( "cls" )
switch( e ){
case 'A':{
color(rand()%15+1)
cout <<" # " <<endl
color(rand()%15+1)
cout <<"# #" <<endl
color(rand()%15+1)
cout <<" # # " <<endl
color(rand()%15+1)
cout <<" ####### " <<endl
color(rand()%15+1)
cout <<" # # " <<endl
color(rand()%15+1)
cout <<"# #" <<endl
color(rand()%15+1)
cout <<" # # " <<endl
break
}
case 'B':{
color(rand()%15+1)
cout <<"######### " <<endl
color(rand()%15+1)
cout <<"## " <<endl
color(rand()%15+1)
cout <<"## " <<endl
color(rand()%15+1)
cout <<"######### " <<endl
color(rand()%15+1)
cout <<"## " <<endl
color(rand()%15+1)
cout <<"## " <<endl
color(rand()%15+1)
cout <<"######### " <<endl
break
}
case 'c':{
color(rand()%15+1)
cout <<" ######### " <<endl
color(rand()%15+1)
cout <<"# " <<endl
color(rand()%15+1)
cout <<"# " <<endl
color(rand()%15+1)
cout <<"# " <<endl
color(rand()%15+1)
cout <<"# " <<endl
color(rand()%15+1)
cout <<"# " <<endl
color(rand()%15+1)
cout <<" ######## " <<endl
break
}
}
color(rand()%15+1)
cout <<"You are very LUKY!" <<endl
cout <<"Please turn your head!" <<endl
cout <<"Tab return to continue..."
cout <<endl
color(0)
system( "pause" )
color(rand()%1023+1)
cout <<"Are you happy?!" <<endl
color(rand()%1023+1)
cout <<"I think you are!!!" <<endl
color(rand()%1023+1)
cout <<"...-..---..-.-.--!"
Sleep ( 3000 )
cout <<endl
color(15)
cout <<"######" <<endl
cout <<" #" <<endl
cout <<"######" <<endl
cout <<" #" <<endl
cout <<"######" <<endl
Sleep( 2000 )
system( "cls" )
cout <<" @@@@ " <<endl
cout <<"@@" <<endl
cout <<" @ " <<endl
cout <<" @ " <<endl
cout <<"@@@@@@" <<endl
Sleep ( 2000 )
system( "cls" )
cout <<" !! " <<endl
cout <<" !!! " <<endl
cout <<" !! " <<endl
cout <<" !! " <<endl
cout <<"!!!!!!" <<endl
Sleep ( 2000 )
system( "cls" )
color( rand()%1023+1 )
cout <<" ###### # # ###### # " <<endl
cout <<" # # # # # # " <<endl
cout <<" # ## ## # " <<endl
cout <<" ###### # ###### # " <<endl
cout <<" # # # # # " <<endl
cout <<" # # # # " <<endl
cout <<" ###### # ###### # " <<endl
color(15)
return 0
}
仅供参考!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)