当前位置: 首页 > news >正文

网站设计怎么用黑色seo排名优化怎样

网站设计怎么用黑色,seo排名优化怎样,wordpress 格局调整,网站备案要邮寄资料吗一、功能介绍 该项目实现的功能主要有#xff1a; 在首页显示一个按钮点击该按钮跳转到桃园页面在桃园页面#xff0c;点击桃子会弹窗显示摘到几个桃子#xff0c;同时被点击桃子消失#xff0c;总桃子数1点击退出桃园会返回首页#xff0c;首页桃子数会根据点击的桃子数…一、功能介绍 该项目实现的功能主要有 在首页显示一个按钮点击该按钮跳转到桃园页面在桃园页面点击桃子会弹窗显示摘到几个桃子同时被点击桃子消失总桃子数1点击退出桃园会返回首页首页桃子数会根据点击的桃子数动态增加 二、代码实现 1. 资源准备 将项目所需要的图片bg.png、monkey.png、btn_peach.png、peach_pic.png 导入程序的drawablehdpi文件夹中默认情况下程序中没有drawable-hdpi 文件夹需手动在res 文件夹中创建一个。 2. 布局文件设计 2.1 主Activity 在layout文件夹中编辑activity_main.xml ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationverticalTextViewandroid:layout_widthmatch_parentandroid:layout_height50dpandroid:background#008577android:gravitycenterandroid:text首页android:textColorandroid:color/whiteandroid:textSize20sp /RelativeLayoutandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:backgrounddrawable/bgandroid:gravitycenter_verticalImageViewandroid:idid/iv_monkeyandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:srcdrawable/monkey /Buttonandroid:idid/btn_peachandroid:layout_width80dpandroid:layout_height40dpandroid:layout_marginLeft30dpandroid:layout_marginTop250dpandroid:layout_toRightOfid/iv_monkeyandroid:backgrounddrawable/btn_peachandroid:gravitycenterandroid:text去桃园android:textColorandroid:color/blackandroid:textSize18sp /ImageViewandroid:idid/iv_peachandroid:layout_width45dpandroid:layout_height35dpandroid:layout_belowid/btn_peachandroid:layout_centerHorizontaltrueandroid:layout_marginTop20dpandroid:srcdrawable/peach_pic /TextViewandroid:idid/tv_countandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_belowid/btn_peachandroid:layout_marginTop25dpandroid:layout_marginLeft10dpandroid:layout_toRightOfid/iv_peachandroid:text摘到0 个android:textColorandroid:color/blackandroid:textSize20sp //RelativeLayout /LinearLayout2.2 辅Activity 在layout文件夹中新增activity_peach.xml ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationverticalTextViewandroid:layout_widthmatch_parentandroid:layout_height50dpandroid:background#008577android:gravitycenterandroid:text桃园android:textColorandroid:color/whiteandroid:textSize20sp /RelativeLayoutandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:backgrounddrawable/tree_bgRelativeLayoutandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_centerInParenttrueandroid:layout_marginTop70dpandroid:backgrounddrawable/treeButtonandroid:idid/btn_oneandroid:layout_width55dpandroid:layout_height40dpandroid:layout_marginLeft140dpandroid:layout_marginTop35dpandroid:backgrounddrawable/peach_pic /Buttonandroid:idid/btn_twoandroid:layout_width55dpandroid:layout_height40dpandroid:layout_belowid/btn_oneandroid:layout_marginLeft80dpandroid:layout_marginTop5dpandroid:backgrounddrawable/peach_pic /Buttonandroid:idid/btn_threeandroid:layout_width55dpandroid:layout_height40dpandroid:layout_belowid/btn_oneandroid:layout_marginLeft70dpandroid:layout_marginTop5dpandroid:layout_toRightOfid/btn_twoandroid:backgrounddrawable/peach_pic /Buttonandroid:idid/btn_fourandroid:layout_width55dpandroid:layout_height40dpandroid:layout_belowid/btn_twoandroid:layout_marginLeft25dpandroid:layout_marginTop15dpandroid:backgrounddrawable/peach_pic /Buttonandroid:idid/btn_fiveandroid:layout_width55dpandroid:layout_height40dpandroid:layout_belowid/btn_twoandroid:layout_marginLeft70dpandroid:layout_marginTop15dpandroid:layout_toRightOfid/btn_fourandroid:backgrounddrawable/peach_pic /Buttonandroid:idid/btn_sixandroid:layout_width55dpandroid:layout_height40dpandroid:layout_belowid/btn_twoandroid:layout_marginLeft45dpandroid:layout_marginTop15dpandroid:layout_toRightOfid/btn_fiveandroid:backgrounddrawable/peach_pic //RelativeLayoutButtonandroid:idid/btn_exitandroid:layout_width100dpandroid:layout_height40dpandroid:layout_alignParentRighttrueandroid:layout_alignParentBottomtrueandroid:layout_margin50dpandroid:backgrounddrawable/btn_peachandroid:text退出桃园android:gravitycenterandroid:textColorandroid:color/blackandroid:textSize18sp//RelativeLayout /LinearLayout2.3 其他资源文件 主题文件themes.xml resources xmlns:toolshttp://schemas.android.com/tools!-- Base application theme. --style nameTheme.PickPeach parentTheme.MaterialComponents.DayNight.DarkActionBar.Bridge!-- Primary brand color. --item namecolorPrimarycolor/colorPrimary/itemitem namecolorPrimaryVariantcolor/colorPrimaryDark/itemitem namecolorOnPrimarycolor/white/item!-- Secondary brand color. --item namecolorSecondarycolor/teal_200/itemitem namecolorSecondaryVariantcolor/teal_700/itemitem namecolorOnSecondarycolor/black/item!-- Status bar color. --item nameandroid:statusBarColor tools:targetApil?attr/colorPrimaryVariant/item!-- Customize your theme here. --/stylestyle nameMyCustomTheme parentTheme.AppCompat.Light.NoActionBar!-- Primary brand color. --item namecolorPrimarycolor/colorPrimary/itemitem namecolorPrimaryVariantcolor/colorPrimaryDark/itemitem namecolorOnPrimarycolor/white/item!-- Secondary brand color. --item namecolorSecondarycolor/teal_200/itemitem namecolorSecondaryVariantcolor/teal_700/itemitem namecolorOnSecondarycolor/black/item!-- Status bar color. --item nameandroid:statusBarColor tools:targetApil?attr/colorPrimaryVariant/item!-- Customize your theme here. --/style /resources3. 实现逻辑功能 3.0 全局配置文件 ?xml version1.0 encodingutf-8? manifest xmlns:androidhttp://schemas.android.com/apk/res/androidpackagecom.hzj.pickpeachapplicationandroid:allowBackuptrueandroid:iconmipmap/ic_launcherandroid:labelstring/app_nameandroid:roundIconmipmap/ic_launcher_roundandroid:supportsRtltrueandroid:themestyle/MyCustomThemeactivityandroid:name.MainActivityandroid:exportedtrueintent-filteraction android:nameandroid.intent.action.MAIN /category android:nameandroid.intent.category.LAUNCHER //intent-filter/activityactivityandroid:name.PeachActivityandroid:exportedtrue/activity/application/manifest3.1 首页功能 在MainActivity 中实现“去桃园”按钮的点击事件当点击按钮时程序跳转到桃园摘桃的界面。同时还需要接收桃园界面回传过来的桃子个数。 public class MainActivity extends AppCompatActivity {private Button btn_peach;private TextView tv_count;private int totalCount 0;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);init();}private void init() {btn_peach findViewById(R.id.btn_peach);tv_count findViewById(R.id.tv_count);//为按钮设置点击事件监听器btn_peach.setOnClickListener(new View.OnClickListener() {Overridepublic void onClick(View view) {//设置意图对象实现界面跳转Intent intent new Intent(MainActivity.this, PeachActivity.class);startActivityForResult(intent, 1); // startActivity(intent);}});}Overrideprotected void onActivityResult(int requestCode, int resultCode, Nullable Intent data) {super.onActivityResult(requestCode, resultCode, data);//判断请求码和返回码是否正确if (requestCode1 requestCode1) {//获取回传的数据int count data.getIntExtra(count, 0);;totalCount totalCount count;tv_count.setText(摘到 totalCount 个);}} }3.2 桃园界面的摘桃效果 点击桃子实现摘桃效果同时全局桃子数动态变化点击退出桃园返回首页同时更新首页桃子数。 public class PeachActivity extends AppCompatActivity implements View.OnClickListener {private Button btn_one, btn_two, btn_three, btn_four, btn_five, btn_six, btn_exit;private int count 0;//桃子个数Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_peach);init();}private void init() {btn_one findViewById(R.id.btn_one);btn_two findViewById(R.id.btn_two);btn_three findViewById(R.id.btn_three);btn_four findViewById(R.id.btn_four);btn_five findViewById(R.id.btn_five);btn_six findViewById(R.id.btn_six);btn_exit findViewById(R.id.btn_exit);btn_one.setOnClickListener(this);btn_two.setOnClickListener(this);btn_three.setOnClickListener(this);btn_four.setOnClickListener(this);btn_five.setOnClickListener(this);btn_six.setOnClickListener(this);btn_exit.setOnClickListener(this);}Overridepublic void onClick(View view) {switch (view.getId()) {case R.id.btn_one: //第一个桃子的点击事件info(btn_one);break;case R.id.btn_two: //第二个桃子的点击事件info(btn_two);break;case R.id.btn_three: //第三个桃子的点击事件info(btn_three);break;case R.id.btn_four: //第四个桃子的点击事件info(btn_four);break;case R.id.btn_five: //第五个桃子的点击事件info(btn_five);break;case R.id.btn_six: //第六个桃子的点击事件info(btn_six);break;case R.id.btn_exit: //“退出桃园”按钮的点击事件returnData();break;default:throw new IllegalStateException(Unexpected value: view.getId());}}/*** 按钮的点击事件处理*/private void info(Button btn) {//桃子个数加1count;//被摘掉的桃子设置为隐藏不可见btn.setVisibility(View.INVISIBLE);Toast.makeText(PeachActivity.this, 摘到 count 个桃子,Toast.LENGTH_LONG).show();}/*** 将数据回传到上个界面*/private void returnData() {//设置意图对象将摘桃子的个数回传给首页界面Intent intent new Intent();intent.putExtra(count, count);//返回码标识setResult(1, intent);//销毁本界面PeachActivity.this.finish();}Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) {//当点击设备返回键时调用数据回传方法返回首页界面if (keyCode KeyEvent.KEYCODE_BACK event.getRepeatCount() 0) {returnData();}return false;} }三、效果展示
http://www.zqtcl.cn/news/765310/

相关文章:

  • 全运网站的建设徐州网络推广公司排名
  • 成品网站源码1688体验区南宁网络推广服务商
  • 广州品牌网站开发公司网站建设价位
  • 网站首页没排名但内页有排名wordpress网站收录插件
  • 在线相册jsp网站开发与设计微信小程序app下载
  • 广元市建设局网站首页网站建设首选公司哪家好
  • 商务网站建设策划思路平台网站如何做推广方案设计
  • 哈尔滨网站快速排名通辽网站建设
  • 雄安专业网站建设哪家好分销系统网站建设
  • 咨询行业网站开发wordpress5.0新版如何发布文章
  • 做网站要什么技术saas建站和开源建站的区别
  • 大型网站建设哪家服务好qq对话制作器app
  • 做免费小说网站怎样赚钱网络推广方案最新
  • 电商网站的建设与运营揭阳专业的网站建设价格
  • 网站策划书包括哪些内容百度官方营销推广平台有哪些
  • 成都企业网站seo重庆企业网站推广费用
  • 广东电白建设集团有限公司网站wordpress 静态地址
  • 微网站和手机站区别工业设计专业学什么
  • 兰州网站建设哪里好素材图片高清
  • 公司网站建设进度设计官网登录入口
  • 中牟高端网站建设wordpress可视化文章
  • 那家公司做网站广西网络营销外包公司
  • 成品网站速成网站知名网站建设加盟合作
  • 零基础学pytho 网站开发Drupal对比WordPress
  • 网站开发 例子快影
  • 宁津建设局网站推介网站
  • c 是用来做网站的吗中国营销策划网
  • 在建设部网站首页莒县网页设计
  • 河北省城乡和住房建设厅网站网店代运营托管
  • 彩票网站建设wordpress判断用户权限