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

沛县做网站xlec如何建立公司网站链接

沛县做网站xlec,如何建立公司网站链接,网站开发方式,做网站还挣钱吗UI学习 UI分类 安卓的UI分为两大类#xff1a;一类叫做View视图#xff0c;一类叫做ViewGroup容器 View视图#xff1a;TextView,Button,ImageView都是常见的视图ViewGroup容器#xff1a;内部尅承载、放置、添加View视图的容器 布局方式 安卓布局主要有#xff1a;线…UI学习 UI分类 安卓的UI分为两大类一类叫做View视图一类叫做ViewGroup容器 View视图TextView,Button,ImageView都是常见的视图ViewGroup容器内部尅承载、放置、添加View视图的容器 布局方式 安卓布局主要有线性布局、相对布局、帧布局、约束布局 LinearLayout线性布局 LinearLayout线性布局横着或者竖着 按顺序排列 其属性主要有 orientation排列方向主要有vertical垂直排列、horizontal水平排列layout_width/height宽度主要有三种类型 填充父容器剩余空间match_parent根据子视图宽度自适应自己的宽高wrap_content自定义大小比如50dp background背景颜色gravity重力决定子控件相对该父容器的位置。主要有三种 center居中显示 horizontal_center水平居中 vertical_center垂直居中layout_gravity决定该容器相对它的父容器的位置 ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationverticalandroid:background#FF2299android:gravitycenterButtonandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:backgroundTint#FF00FF/Buttonandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:backgroundTint#FFFF00/Buttonandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:backgroundTint#00FF00//LinearLayout RelativeLayout相对布局 在摆放子视图位置时按照指定的参考系摆放子视图的位置默认以屏幕左上角(0, 0)位置作为参考系摆放位置 主要有三大类 相对父元素相对兄弟元素相对兄弟元素对齐方式 ?xml version1.0 encodingutf-8? RelativeLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentButtonandroid:idid/btn1android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:insetTop0dpandroid:insetBottom0dpandroid:text按钮1/Buttonandroid:idid/btn2android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:insetTop0dpandroid:insetBottom0dpandroid:text按钮2android:layout_toRightOfid/btn1android:layout_belowid/btn1/Buttonandroid:idid/btn3android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:insetTop0dpandroid:insetBottom0dpandroid:text按钮3android:layout_toRightOfid/btn2android:layout_belowid/btn2/Buttonandroid:idid/btn4android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:insetTopdpandroid:insetBottom0dpandroid:text按钮4android:layout_toRightOfid/btn3android:layout_belowid/btn3/ /RelativeLayoutFrameLayout帧布局 组件的默认位置都是左上角组件之间可以重叠 设置方式与线性布局相似 具体UI Button之MaterialButton Material: 重要的 MaterialButton是Google推出的新控件比较好用 使用步骤 1.添加依赖 在app下的build.gradle文件下dependencies里添加依赖implementation com.google.android.material:material:1.10.0 然后执行Sync Now 2.修改app的theme主题 修改地方 将其parenter修改为Theme.MaterialComponents.Light.NoActionBar 一些常见属性 写的一些效果 MaterialButtonToggleGroup 类似于iOS的segment com.google.android.material.button.MaterialButtonToggleGroupandroid:idid/material_groupandroid:layout_widthmatch_parentandroid:layout_height60dpandroid:layout_marginLeft10dpandroid:layout_marginRight10dpandroid:gravitycenterapp:checkedButtonid/btn2com.google.android.material.button.MaterialButtonandroid:idid/btn1android:layout_width0dpandroid:layout_height50dpandroid:layout_weight1android:textTAB1app:cornerRadius15dpandroid:insetTop0dpandroid:insetBottom0dpandroid:gravitycenter/com.google.android.material.button.MaterialButtonandroid:idid/btn2android:layout_width0dpandroid:layout_height50dpandroid:layout_weight1android:textTAB2app:cornerRadius20dpandroid:insetTop0dpandroid:insetBottom0dpandroid:gravitycenter/com.google.android.material.button.MaterialButtonandroid:idid/btn3android:layout_width0dpandroid:layout_height50dpandroid:layout_weight1android:textTAB3app:cornerRadius20dpandroid:insetTop0dpandroid:insetBottom0dpandroid:gravitycenter//com.google.android.material.button.MaterialButtonToggleGroup监听的时候 //通过id找到对象val toggleGroup findViewByIdMaterialButtonToggleGroup(R.id.material_group)//对象添加监听//参数是一个接口前面需要加上object: 关键字toggleGroup.addOnButtonCheckedListener(object: MaterialButtonToggleGroup.OnButtonCheckedListener{//里面是实现接口的方法override fun onButtonChecked(group: MaterialButtonToggleGroup?,checkedId: Int,isChecked: Boolean) {Log.e(MaterialButton, ${checkedId}, ${isChecked.toString()});}})TextView LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:gravitycenter_horizontalTextViewandroid:idid/textView2android:layout_width200dpandroid:layout_height160dpandroid:text111111111111111111111111111111android:textSize22dpandroid:textColor#ffffff//使用这个跑马灯才管用android:singleLinetrueandroid:backgroundcolor/purple_700android:layout_marginTop30dpandroid:ellipsizemarqueeandroid:marqueeRepeatLimit-1android:focusabletrueandroid:focusableInTouchModetrueandroid:drawableLeftandroid:drawable/btn_starandroid:drawableRightandroid:drawable/btn_starandroid:drawableTopandroid:drawable/btn_dialogandroid:drawableBottomandroid:drawable/btn_dropdown//LinearLayout在activity里面调用val tv findViewByIdTextView(R.id.textView2) tv.requestFocus()ImageView 图片名不能以数字开头 center :保持原图的大小显示在ImageView的中心。当原图的长(宽)大于ImageView的长(宽)超过部分裁剪处理。centerCrop :以填满整个ImageView为目的将原图的中心对准ImageView的中心等比例放大原图直到填满ImageView为止指的是ImageView的宽和高都要填满原图超过ImageView的部分作裁剪处理。centerInside :以原图完全显示为目的将图片的内容完整居中显示通过按比例缩小原图的长(宽)等于或小于ImageView的长(宽)。如果原图的长宽本身就小于ImageView的长宽则原图不作任何处理居中显示在ImageView。fitCenter :把原图按比例扩大或缩小到ImageView的ImageView的高度居中显示fitEnd :把原图按比例扩大(缩小)到ImageView的高度显示在ImageView的下部分位置fitStart :把原图按比例扩大(缩小)到ImageView的高度显示在ImageView的上部分位置fitXY :把原图按照指定的大小在View中显示拉伸显示图片不保持原比例填满ImageView.matrix :不改变原图的大小从ImageView的左上角开始绘制原图原图超过ImageView的部 分作裁剪处理。 RecyclerView 类似tableViewcollectionView adapter数据源 来一个简单的List private val data listOf(Apple, Banana, Orange, Watermelon, Pear, Grape, Pineapple, Strawberry, Cherry, Mango, Apple, Banana, Orange, Watermelon, Pear, Grape, Pineapple, Strawberry, Cherry, Mango)override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)setContentView(R.layout.activity_main)//注意android.R.layout.simple_list_item_1val adapter ArrayAdapterString(this, android.R.layout.simple_list_item_1, data)val recyclerView findViewByIdListView(R.id.listView)recyclerView.adapter adapter}在xml上写上ListViewListViewandroid:idid/listViewandroid:layout_widthmatch_parentandroid:layout_heightmatch_parent/自定义列表 使用recyclerView class MainActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)setContentView(R.layout.activity_main)//找到recyclerViewval recyclerView findViewByIdRecyclerView(R.id.recyclerView)//管理者负责列表的布局recyclerView.layoutManager LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)recyclerView.adapter MyAdapter1()}//创建一个adapter负责数据的适配class MyAdapter1: RecyclerView.AdapterMyViewHolder() {override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {//找到itemval cellView LayoutInflater.from(parent.context).inflate(R.layout.textview_test, parent, false)return MyViewHolder(cellView)}//个数override fun getItemCount(): Int {return 20}override fun onBindViewHolder(holder: MyViewHolder, position: Int) {}}//负责列表的复用class MyViewHolder(view: View): RecyclerView.ViewHolder(view){} } 跳转 显示跳转 val btn findViewByIdMaterialButton(R.id.jump_button)btn.setOnClickListener {val intent Intent(this, secondActivity::class.java)//传值intent.putExtra(key, 22222)startActivity(intent)}//接收值val dataString intent.getStringExtra(key)例子 作业结果
http://www.huolong8.cn/news/403931/

相关文章:

  • 做网站的设计理念做网站材料
  • 优化网站公司成都互联网公司排名
  • 响应式网站建设智能优化百度推广官网推荐:sk67666
  • 手机wap网站程序网站为契机建设校园数字化
  • 广州网站建设推广公司有哪些石家庄最新今天的消息
  • 深圳市建网站怎么样创建一个网站
  • jsp网站开发详解书籍东莞加工厂外发网
  • 山东省建设厅网站首页做冷库的网站
  • 淘宝建设网站的目的是什么有趣的网站网址
  • 如果做游戏的技术用来做网站网站建设所需
  • 网站建设与网站主机的选择带产品多用户商城
  • 十大网站app软件下载网站开发文档有哪些
  • 猪八戒网怎么做网站网站设计教学
  • 做建材的网站有哪些合肥网站建设需要多少钱
  • 公司网站建设费有没有学做蛋糕的网站和视频
  • asp网站加速常州迅捷网络
  • 营销型企业网站建设的步骤招远市建设局网站
  • 申请网站建设的请示metro 导航网站
  • 广州住房公积金建设银行预约网站首页紧急访问升级狼人通知
  • 58黄页网推广公司响应式网站 乐云seo品牌
  • 如何快速建立一个网站网站分页需要前端做还是后端
  • 做空的网站有哪些公司做网站属于什么费用
  • 长沙网站开发培训logo设计在线生成免费免费设计logo生成器
  • 品牌商城网站开发创新的赣州网站建设
  • 怎样做免费企业网站wordpress互联网访问
  • 网站建设实习收获网站模板安装好后
  • 创业型企业网站模板河间哪里有做网站的
  • 外国网站接单做翻译顺义企业网站建站公司
  • 房地产营销门户网站开发网站建设500错误代码
  • pageadmin做的网站的域名必须要备案吗找工作的平台