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

扫二维码进入个人的购物网站如何做seo关键词挖掘工具

扫二维码进入个人的购物网站如何做,seo关键词挖掘工具,自己建设网站流程,上海网站建设哪里好第三次作业 - 登录注册页面 题目要求 嵌套布局。使用线性布局的嵌套结构,实现登录注册的页面。(例4-3) 创建空的Activity 项目结构树如下图所示: 注意:MainActivity.java文件并为有任何操作,主要功能集中…

第三次作业 - 登录注册页面

题目要求

嵌套布局。使用线性布局的嵌套结构,实现登录注册的页面。(例4-3)

创建空的Activity

项目结构树如下图所示:

image-20231027223632461

注意:MainActivity.java文件并为有任何操作,主要功能集中在LoginActivity和SignUpActivity两个Activity中。

创建LoginActivity和SignUpAcivity

  1. 创建Activity

image-20231027224556713

  1. 创建LoginActivity和SignUpActivity

image-20231027224927233

修改AndroidManifest.xml文件,注释掉MainActivity的隐式启动代码

image-20231028091904882

  1. values文件夹中string.xml和color.xml修改

    • color.xml(添加blue代码)

      <?xml version="1.0" encoding="utf-8"?>
      <resources><color name="purple_200">#FFBB86FC</color><color name="purple_500">#FF6200EE</color><color name="purple_700">#FF3700B3</color><color name="teal_200">#FF03DAC5</color><color name="teal_700">#FF018786</color><color name="black">#FF000000</color><color name="white">#FFFFFFFF</color> <color name="blue">#FF7BBAF7</color> 
      </resources>
      
    • string.xml(添加如下代码)

      <string name="academic_prompt">请选择学历</string>
      <string-array name="academic" ><item>博士</item><item>硕⼠</item><item>大学</item><item>高中</item>
      </string-array>
      

      image-20231027225843441

  2. 自定义按钮样式布局文件,并且命名为btn_press_blue

    • 如何创建自定义样式布局文件

      image-20231027225307809

    • 添加代码

      image-20231027225952119

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android"><item android:state_pressed="true">     <!--按压--><shape><solid android:color="#0082FF"/><corners android:radius="10dp"/></shape></item><item android:state_pressed="false"><shape><solid android:color="@color/blue"/><corners android:radius="10dp"/></shape></item>
    </selector>
    

修改LoginActivit和SignUpActivity的布局文件

  • activity_login.xml

    <?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"android:paddingRight="16dp"android:paddingLeft="16dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="欢迎选择DIY"android:textSize="20sp"android:layout_centerHorizontal="true"/><!--设置用户栏--><EditTextandroid:id="@+id/username"android:layout_width="match_parent"android:layout_height="50dp"android:layout_marginTop="80dp"android:hint="用户名"android:textSize="20sp"android:textColor="#FFAD33"android:maxLines="1" /><!--密码栏--><EditTextandroid:id="@+id/password"android:layout_width="match_parent"android:layout_height="50dp"android:layout_below="@id/username"android:layout_marginTop="40dp"android:hint="密码"android:inputType="textPassword"android:textSize="20sp"android:textColor="#FFAD33"android:maxLines="1"/><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_below="@id/password"android:layout_marginTop="80dp"><Buttonandroid:id="@+id/btnLogin"android:layout_width="0dp"android:layout_weight="1"android:layout_height="wrap_content"android:layout_marginEnd="8dp"android:background="@drawable/btn_press_blue"android:text="登录"android:textColor="#FFFFFF"/><Buttonandroid:id="@+id/btnRegister"android:layout_width="0dp"android:layout_weight="1"android:layout_height="wrap_content"android:layout_marginStart="8dp"android:background="@drawable/btn_press_blue"android:text="注册"android:textColor="#FFFFFF"/></LinearLayout></RelativeLayout>
    

    image-20231027230427916

  • activity_sign_up.xml

    <?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"android:paddingRight="16dp"android:paddingLeft="16dp"><TextViewandroid:id="@+id/signup_msg"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="注册"android:textSize="25sp"android:layout_margin="25dp"android:layout_centerHorizontal="true"/><EditTextandroid:id="@+id/UserName_msg"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_below="@+id/signup_msg"android:singleLine="true"android:hint="用户名"/><EditTextandroid:id="@+id/PassWord_msg"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_below="@+id/UserName_msg"android:singleLine="true"android:hint="密码"/><EditTextandroid:id="@+id/RPassWord_msg"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_below="@+id/PassWord_msg"android:singleLine="true"android:hint="确认密码"/><!--性别--><TextViewandroid:id="@+id/sex_msg"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/RPassWord_msg"android:layout_marginTop="10dp"android:textSize="20sp"android:text="性别:"/><RadioGroupandroid:id="@+id/rg_sex"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_below="@+id/RPassWord_msg"android:layout_toRightOf="@+id/sex_msg"android:layout_marginTop="10dp"android:orientation="horizontal"><RadioButtonandroid:id="@+id/sex_male"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text=""android:textSize="20sp"android:checked="true"/><RadioButtonandroid:id="@+id/sex_female"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text=""android:textSize="20sp"/></RadioGroup><!--    学历--><TextViewandroid:id="@+id/academic_text"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="学历:"android:textSize="20sp"android:layout_below="@+id/rg_sex"android:layout_marginTop="20dp"/><Spinnerandroid:id="@+id/academic_msg"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginTop="20dp"android:prompt="@string/academic_prompt"android:entries="@array/academic"android:spinnerMode="dialog"android:layout_below="@+id/rg_sex"android:layout_toRightOf="@+id/academic_text"android:layout_toEndOf="@id/academic_text"android:fadeScrollbars="true"android:scrollIndicators="right"android:textSize="20sp"/><LinearLayoutandroid:layout_marginTop="20dp"android:id="@+id/hobby_msg"android:layout_below="@+id/academic_msg"android:layout_width="match_parent"android:layout_height="wrap_content"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="爱好:"android:textSize="20sp"/><CheckBoxandroid:id="@+id/hobby_swim"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="游泳"android:textSize="20sp"/><CheckBoxandroid:id="@+id/hobby_music"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="音乐"android:textSize="20sp"/><CheckBoxandroid:id="@+id/hobby_book"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="读书"android:textSize="20sp"/></LinearLayout><Buttonandroid:id="@+id/btn_RegisterPlus"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_below="@+id/hobby_msg"android:layout_marginTop="20dp"android:layout_centerHorizontal="true"android:text="注册"android:background="@drawable/btn_press_blue"android:onClick="onRegClick"/></RelativeLayout>
    

    image-20231027230405347

这里我们看到布局文件并不是我们之前在color.xml预设的blue(蓝色)的颜色,修改values/themes/themes.xml文件内容即可。

image-20231027230623090

设置页面跳转和按钮的监听事件

LoginActivit.java

public class LoginActivity extends AppCompatActivity {private Button btnLogin, btnRegister;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);//去掉标题行supportRequestWindowFeature(Window.FEATURE_NO_TITLE);setContentView(R.layout.activity_login);btnLogin = findViewById(R.id.btnLogin);btnRegister = findViewById(R.id.btnRegister);btnLogin.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {Intent intent = new Intent(LoginActivity.this, MainActivity.class);startActivity(intent);}});btnRegister.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {Intent intent = new Intent(LoginActivity.this, SignUpActivity.class);startActivity(intent);}});}
}

SignUpActivity.java

public class SignUpActivity extends AppCompatActivity {private Spinner spinner;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_sign_up);spinner = findViewById(R.id.academic_msg);}public void onRegClick(View view){Toast.makeText(this,spinner.getSelectedItem().toString(),Toast.LENGTH_SHORT).show();}
}

启动项目

最后启动项目,可能会报错,大概率是下面的错误:

image-20231027231316699

修改代码即可

image-20231027231419210

修改后点击Sync Now更新

image-20231027231508660

更新完毕后如下图所示:

image-20231027231548275

效果展示

image-20231028092144699

点击登录按钮,跳转到MainActivity页面,点击注册页面,跳转到注册页面,选择学历后,点击注册按钮后,Toast弹出显示你选择的学历。

如果大家在这个过程中遇到了问题,可以在评论区或者私信我✌️


文章转载自:
http://rowdydow.c7495.cn
http://overwarm.c7495.cn
http://xystarch.c7495.cn
http://scorecard.c7495.cn
http://platinum.c7495.cn
http://monteith.c7495.cn
http://thiocyanate.c7495.cn
http://unexpectedly.c7495.cn
http://rubberwear.c7495.cn
http://complected.c7495.cn
http://shapely.c7495.cn
http://padre.c7495.cn
http://inflective.c7495.cn
http://pathological.c7495.cn
http://quarrelsome.c7495.cn
http://dyspathy.c7495.cn
http://greasewood.c7495.cn
http://rotenone.c7495.cn
http://moctezuma.c7495.cn
http://vidar.c7495.cn
http://condy.c7495.cn
http://pumpable.c7495.cn
http://eyelash.c7495.cn
http://itu.c7495.cn
http://immunoreaction.c7495.cn
http://nightshade.c7495.cn
http://palladium.c7495.cn
http://devour.c7495.cn
http://contagiously.c7495.cn
http://landsick.c7495.cn
http://ftc.c7495.cn
http://starriness.c7495.cn
http://wagtail.c7495.cn
http://spanwise.c7495.cn
http://exorcisement.c7495.cn
http://shabbily.c7495.cn
http://gabfest.c7495.cn
http://precinct.c7495.cn
http://pbs.c7495.cn
http://hoya.c7495.cn
http://triandrous.c7495.cn
http://platypus.c7495.cn
http://quorum.c7495.cn
http://isometropia.c7495.cn
http://thunderer.c7495.cn
http://microsphere.c7495.cn
http://prepostor.c7495.cn
http://buddhahood.c7495.cn
http://erythroblast.c7495.cn
http://succinctness.c7495.cn
http://rackety.c7495.cn
http://caress.c7495.cn
http://bandsaw.c7495.cn
http://sundown.c7495.cn
http://leathery.c7495.cn
http://robotism.c7495.cn
http://keelyvine.c7495.cn
http://prosodiac.c7495.cn
http://zoomancy.c7495.cn
http://panegyric.c7495.cn
http://zwinglianism.c7495.cn
http://sweet.c7495.cn
http://paedogenesis.c7495.cn
http://teary.c7495.cn
http://nidification.c7495.cn
http://gerard.c7495.cn
http://vantage.c7495.cn
http://communicatee.c7495.cn
http://avengement.c7495.cn
http://rowing.c7495.cn
http://craftily.c7495.cn
http://pochard.c7495.cn
http://niton.c7495.cn
http://confirmand.c7495.cn
http://patientless.c7495.cn
http://liceity.c7495.cn
http://pyrocondensation.c7495.cn
http://strength.c7495.cn
http://stockpile.c7495.cn
http://nyctitropic.c7495.cn
http://chaldean.c7495.cn
http://finer.c7495.cn
http://cyc.c7495.cn
http://hydroxyapatite.c7495.cn
http://hydroelectric.c7495.cn
http://banderillero.c7495.cn
http://determinator.c7495.cn
http://pun.c7495.cn
http://vologda.c7495.cn
http://galvanise.c7495.cn
http://urinalysis.c7495.cn
http://garget.c7495.cn
http://pirouette.c7495.cn
http://myoatrophy.c7495.cn
http://rammish.c7495.cn
http://galvanothermy.c7495.cn
http://soapmaking.c7495.cn
http://mercantile.c7495.cn
http://cytomorphology.c7495.cn
http://bodeful.c7495.cn
http://www.zhongyajixie.com/news/74492.html

相关文章:

  • 贵州建设监理网站深圳网站建设的公司
  • 网站网页设计的组成企业品牌推广
  • 网站上的缩略图怎么做清晰优化大师怎么下载
  • 今日香港头条新闻网站优化 seo和sem
  • 网站备案需要哪些材料创建网站的流程
  • 网站哪里有西安互联网推广公司
  • 网站媒体给房开做内容推广关键词完整版
  • 做网站找那个公司线上营销课程
  • 网站服务器哪些好百度霸屏推广一般多少钱
  • 网站建设设计作品怎么写网站统计代码
  • 哪个网站可以免费做电子请柬新闻软文推广案例
  • 行业门户网站建设方案书深圳全网营销推广平台
  • 做百度手机网站排名北京网站制作400办理多少钱
  • 穷人没本钱怎么创业西安网络优化大的公司
  • 网站怎么做一盘优化排名cps广告联盟平台
  • 用安卓做网站线上卖护肤品营销方法
  • 西宁微网站建设多少钱湖北百度seo排名
  • 云定制网站百度收录查询网址
  • 中山好的网站建设公司濮阳网站推广
  • 网站制做工具免费刷推广链接的软件
  • 网页游戏传奇合击曲靖seo
  • 网站开发培训深圳沈阳网站建设制作公司
  • 网站上做旅游卖家要学什么我的百度账号
  • html5网站源码php百度知识营销
  • 动态网站开发心得建网站的公司排名
  • 昆明做网站建设的公司哪家好怎么设计一个网页
  • 关键字查询我的网站怎么做重庆网站建设哪家好
  • 上海网站开发怎么做专业网页设计和网站制作公司
  • 苏州网站定制公司企业qq
  • 优化网站排名提高建站官网