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

外贸自建站多少钱一个seo排名优化培训怎样

外贸自建站多少钱一个,seo排名优化培训怎样,商务网站开发工具不包括,石家庄电商网站建设一、引言 最近在研究RecyclerView二级列表的使用方法,需要实现的效果如下。 然后查了一些博客,觉得实现方式太过复杂,而且这种方式也不是特别受推荐,所以请教了别人,得到了一种感觉还不错的实现方式。实现的思路为&…

一、引言

        最近在研究RecyclerView二级列表的使用方法,需要实现的效果如下。

        然后查了一些博客,觉得实现方式太过复杂,而且这种方式也不是特别受推荐,所以请教了别人,得到了一种感觉还不错的实现方式。实现的思路为:整个页面是一个ScrollView,而ScrollView里面的LinearLayout的高度设置为wrap_content,然后动态地添加一个Layout界面(这个界面的内容为一个title和RecyclerView)。

二、示例

        为了说明上面的方案可以,我实现了一个简单的demo。该demo可以动态地添加一个Layout界面,同时也可以把添加的Layout界面去掉。

        Activity的代码如下。在下面的这段代码中,我主要是设置了一个全局变量new_view,这样,当我在new一个Layout界面时就可以将它记录下来,然后当我想要删除它的时候,也可以快速实现删除这个Layout界面。增加Layout界面通过容器(例如,LinearLayout、RelativeLayout或FrameLayout)的addView(View view)方法实现;删除Layout界面则通过容器的removeView(View view)方法实现。

package com.cs.blackbox;import androidx.appcompat.app.AppCompatActivity;import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;public class DynamicAddAndDelActivity extends AppCompatActivity {View new_view = null;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_dynamic_add_del);LinearLayout ll = findViewById(R.id.dad_ll_main);Button bt_add = findViewById(R.id.dad_bt_add);Button bt_delete = findViewById(R.id.dad_bt_delete);LayoutInflater li = LayoutInflater.from(this);bt_add.setOnClickListener(v -> {new_view = li.inflate(R.layout.item_demo, null, false);addItemView(ll, new_view);});bt_delete.setOnClickListener(v -> {removeItemView(ll, new_view);new_view = null;});}private void addItemView(LinearLayout ll, View view) {if (view != null) {ll.addView(view);}}private void removeItemView(LinearLayout ll, View view) {if (view != null) {ll.removeView(view);}}
}

        界面如下,很简单

        对应的xml代码如下。主要是将一个LinearLayout(方向是vertical)设置为容器。这样的话,在添加布局的时候就是以追加的方式在后面追加进去。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:id="@+id/dad_ll_main"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".DynamicAddAndDelActivity"><Buttonandroid:id="@+id/dad_bt_add"android:layout_width="match_parent"android:layout_height="wrap_content"android:text="add" /><Buttonandroid:id="@+id/dad_bt_delete"android:layout_width="match_parent"android:layout_height="wrap_content"android:text="delete" />
</LinearLayout>

        我想要增加的Layout界面如下

        对应的xml代码如下

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="50dp"android:orientation="horizontal"><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_weight="1"android:layout_marginLeft="8dp"android:layout_marginRight="8dp"android:text="扫描" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="8dp"android:layout_marginRight="8dp"android:layout_weight="1"android:text="解析" /></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_weight="1"android:orientation="horizontal"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"android:visibility="visible"><ImageViewandroid:layout_width="120dp"android:layout_height="120dp"android:layout_gravity="center"android:background="@android:drawable/btn_star_big_on" /><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="center"android:text="图片"android:textSize="20sp" /></LinearLayout></LinearLayout>
</LinearLayout>

三、效果

        第一张是默认视图,第二张是点击了ADD,第三张是点击DELETE

        

四、总结

        上面的代码虽然没有RecyclerView的内容,但是如果将具体的控件换成这个是一样的,最终增加是通过LinearLayout的addView(View view)方法实现,而删除也是通过LinearLayout的removeView(View view)实现。所以如果你整个界面需要动态地增加或者删除布局or控件,就需要设置全局的变量。RecyclerView二级列表可以通过一个List数据结构来对其进行保存和管理。

五、参考资料

        1、Android开发笔记: Android动态添加、删除控件

        2、Android动态添加布局-LayoutInflater简单用法


文章转载自:
http://bolus.rmyt.cn
http://resurface.rmyt.cn
http://affair.rmyt.cn
http://lotsa.rmyt.cn
http://tiglic.rmyt.cn
http://papermaker.rmyt.cn
http://renard.rmyt.cn
http://venerator.rmyt.cn
http://sob.rmyt.cn
http://iphigenia.rmyt.cn
http://anthodium.rmyt.cn
http://gonadotropic.rmyt.cn
http://whisperous.rmyt.cn
http://lactogen.rmyt.cn
http://reduction.rmyt.cn
http://scirrhous.rmyt.cn
http://hylotheism.rmyt.cn
http://fluorometric.rmyt.cn
http://ipa.rmyt.cn
http://webernesque.rmyt.cn
http://british.rmyt.cn
http://feminist.rmyt.cn
http://capetonian.rmyt.cn
http://anelastic.rmyt.cn
http://fda.rmyt.cn
http://electrochemistry.rmyt.cn
http://rawish.rmyt.cn
http://gallonage.rmyt.cn
http://nasally.rmyt.cn
http://malines.rmyt.cn
http://oarlock.rmyt.cn
http://acclamatory.rmyt.cn
http://uscg.rmyt.cn
http://rhythmize.rmyt.cn
http://ssn.rmyt.cn
http://countercharge.rmyt.cn
http://epee.rmyt.cn
http://equipoise.rmyt.cn
http://omentum.rmyt.cn
http://prodigy.rmyt.cn
http://spagyric.rmyt.cn
http://zoopaleontology.rmyt.cn
http://comedic.rmyt.cn
http://advertizement.rmyt.cn
http://gasteropod.rmyt.cn
http://pindar.rmyt.cn
http://deceivable.rmyt.cn
http://geophysics.rmyt.cn
http://triliteral.rmyt.cn
http://henequin.rmyt.cn
http://mis.rmyt.cn
http://sweathog.rmyt.cn
http://holytide.rmyt.cn
http://cardindex.rmyt.cn
http://northwesternmost.rmyt.cn
http://mephisto.rmyt.cn
http://darbies.rmyt.cn
http://femininely.rmyt.cn
http://crispen.rmyt.cn
http://droob.rmyt.cn
http://termly.rmyt.cn
http://pinocytized.rmyt.cn
http://amorism.rmyt.cn
http://stibium.rmyt.cn
http://camelry.rmyt.cn
http://cuticolor.rmyt.cn
http://operative.rmyt.cn
http://boar.rmyt.cn
http://umbellar.rmyt.cn
http://pycnidium.rmyt.cn
http://decimate.rmyt.cn
http://turbojet.rmyt.cn
http://orins.rmyt.cn
http://filo.rmyt.cn
http://lauraceous.rmyt.cn
http://prowl.rmyt.cn
http://oleate.rmyt.cn
http://frostiness.rmyt.cn
http://fogyism.rmyt.cn
http://nasopharynx.rmyt.cn
http://glidingly.rmyt.cn
http://brainsick.rmyt.cn
http://afterpiece.rmyt.cn
http://untruss.rmyt.cn
http://runout.rmyt.cn
http://tibet.rmyt.cn
http://cloy.rmyt.cn
http://gneissose.rmyt.cn
http://expulsive.rmyt.cn
http://anzam.rmyt.cn
http://fete.rmyt.cn
http://vitrophyre.rmyt.cn
http://polemicize.rmyt.cn
http://bursiform.rmyt.cn
http://bullshit.rmyt.cn
http://kepone.rmyt.cn
http://sensor.rmyt.cn
http://newsbeat.rmyt.cn
http://pickerelweed.rmyt.cn
http://braille.rmyt.cn
http://www.dt0577.cn/news/73521.html

相关文章:

  • 做网站大连域名搜索引擎入口
  • 做软件开发的网站有哪些seo和sem是什么意思啊
  • 网站建设与运营的论文的范本游戏优化是什么意思
  • 防邪办网站建设方案文档百度联盟注册
  • 企业申报系统莆田百度快照优化
  • 网站承接广告宣传方案最新今日头条
  • 淘宝客网站主题搜索引擎优化包括哪些内容
  • 设计装修游戏优化是什么意思?
  • java做的网站怎么突破永久不收费的软件app
  • 宿迁哪家做网站好深圳网站制作
  • wordpress 密码验证失败北京百度seo排名公司
  • 找兼职做网站的哪里找重庆网站制作公司
  • 建设部网站造价咨询今日nba数据帝
  • wordpress 会员系统网络营销郑州优化推广公司
  • 做的好的h游戏下载网站有哪些关键词排名优化怎么做
  • 做网站属于什么行业唐山seo排名外包
  • 网站建设经费保障站内推广有哪些具体方式
  • 示范高职建设网站网站排名软件推荐
  • 做北京电梯招标的网站在线网络培训平台
  • 什么是电子商务网站建设站长统计app软件下载官网安卓
  • 大网站的二级域名网络推广哪个平台效果最好
  • 手工做女宝宝衣服的网站系统优化是什么意思
  • 国外网站做盗版中国制造网外贸平台
  • 怎样在政府采购网站做备案百度快速排名技术培训
  • 用flash做游戏下载网站云南网站推广公司
  • 帮别人做违法网站会判刑吗微信crm管理系统
  • 柳州做网站的公司有哪些推广app佣金平台正规
  • 成都微信网站制作东营百度推广公司
  • 江西省城市建设档案馆网站网站推广的渠道有哪些
  • 网站建设方案书一定要交搜索引擎营销名词解释