自定义view流式布局 已经封装依赖可以直接粘贴使用 然后在项目的build.gradle中 2.布局文件 直接使用 3.在类里面
1.导入依赖implementation 'com.github.LiHangKun:LiuShiBuJu:1'
allprojects { repositories { google() jcenter() maven { url 'https://jitpack.io' }//要添加的 } }
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="https://schemas.android.com/apk/res/android" xmlns:app="https://schemas.android.com/apk/res-auto" xmlns:tools="https://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:layout_width="100dp" android:id="@+id/et" android:layout_height="wrap_content" /> <Button android:id="@+id/bt" android:text="sousuo" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> <com.bw.liushibuju2.FlowLayout android:id="@+id/aaa" android:layout_width="match_parent" android:layout_height="wrap_content"> </com.bw.liushibuju2.FlowLayout> </LinearLayout>
public class MainActivity extends AppCompatActivity { List<String> stringList = new ArrayList<>(); private FlowLayout mFl; private EditText et; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //找控件 mFl = findViewById(R.id.aaa); et = findViewById(R.id.et); //点击搜索 findViewById(R.id.bt).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String gettx = et.getText().toString(); stringList.add(gettx); //清除 mFl.removeAllViews(); for(String string : stringList){ //遍历 并添加TexView LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParams.setMargins(10, 5, 10, 5); TextView textView = new TextView(MainActivity.this); textView.setPadding(20, 10, 20, 10); textView.setText(string); textView.setLayoutParams(layoutParams); mFl.addView(textView, layoutParams); } } }); } }
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算