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

网站建设评选打分网络推广是什么工作内容

网站建设评选打分,网络推广是什么工作内容,wordpress 商城模版,wordpress 特效代码实现效果如下: 如上,将头像后面的东西看作一个整体,因为不能影响后面内容的换行,且前面控件的长度是可变的,所以采用自定义View的方法来实现: /*** CSDN深海呐 https://blog.csdn.net/qq_40945489/articl…

实现效果如下:


如上,将头像后面的东西看作一个整体,因为不能影响后面内容的换行,且前面控件的长度是可变的,所以采用自定义View的方法来实现:

/***  CSDN深海呐 https://blog.csdn.net/qq_40945489/article/details/109399596*/
public class TagTextView extends AppCompatTextView {private Context mContext;private TextView mTabText;private StringBuffer mContentStringBuffer;//必须重写所有的构造器,否则可能会出现无法inflate布局的错误!public TagTextView(Context context) {super(context);mContext = context;}public TagTextView(Context context, AttributeSet attrs) {super(context, attrs);mContext = context;}public TagTextView(Context context, AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);mContext = context;}public void setContentAndTag(String content, List<String> dataList, List<Integer> typeList) {mContentStringBuffer = new StringBuffer();for (String item : dataList) {//将内容添加到content,用drawable替代这些内容所占的位置mContentStringBuffer.append(item);}mContentStringBuffer.append(content);SpannableString spannableString = new SpannableString(mContentStringBuffer);for (int i = 0; i < dataList.size(); i++) {String item = dataList.get(i);View view = LayoutInflater.from(mContext).inflate(R.layout.layout_texttab, null);//R.layout.tag是每个标签的布局switch (typeList.get(i)){case 1:view = LayoutInflater.from(mContext).inflate(R.layout.layout_texttab1, null);break;case 2:view = LayoutInflater.from(mContext).inflate(R.layout.layout_texttab2, null);break;}mTabText = view.findViewById(R.id.tabText);mTabText.setText(item);Bitmap bitmap = convertViewToBitmap(view);Drawable d = new BitmapDrawable(bitmap);d.setBounds(0, 0, mTabText.getWidth(), mTabText.getHeight());ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BOTTOM);//图片对齐底部int startIndex;int endIndex;startIndex = getLastLength(dataList, i );endIndex = startIndex + item.length();spannableString.setSpan(span, startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);}setText(spannableString);setGravity(Gravity.CENTER_VERTICAL);}private static Bitmap convertViewToBitmap(View view) {view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());view.buildDrawingCache();Bitmap bitmap = view.getDrawingCache();return bitmap;}private int getLastLength(List<String> list, int maxLength) {int length = 0;for (int i = 0; i < maxLength; i++) {length += list.get(i).length();}return length;}
}

使用举例:  (😂抱歉啊使用这边没有用Java写,不会Kotlin的应该也能看懂啥意思)

class MainActivity : AppCompatActivity() {override fun onCreate(savedInstanceState: Bundle?) {super.onCreate(savedInstanceState)setContentView(R.layout.activity_main)initView();}private fun initView() {setText("很长很长的一段话一段话一段话  真的很长很长很长......")}private fun setText(string: String) {val title : TagTextView = findViewById(R.id.main_text)val dataList = arrayListOf<String>()dataList.add("用户的名字")dataList.add("48")dataList.add("  长老")val dataListType = arrayListOf<Int>()dataListType.add(0);dataListType.add(1);dataListType.add(2);title.setContentAndTag(""+string+"", dataList,dataListType)}
}

activity_main.xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".MainActivity"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="horizontal"><ImageViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@mipmap/head" /><com.example.demo.TagTextViewandroid:id="@+id/main_text"android:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="center"android:text="当前是用户发的一段话很长很长的一段话,非常长非常长!!!!!!"android:textColor="@color/TextColor"android:textSize="12sp" /></LinearLayout></LinearLayout>

la:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"tools:context=".MainActivity"><TextViewandroid:id="@+id/tabText"android:layout_width="wrap_content"android:layout_height="wrap_content"android:drawablePadding="6dp"android:drawableRight="@mipmap/sex"android:gravity="center"android:paddingRight="8dp"android:text="CSDN深海呐"android:textColor="@color/HeadText"android:textSize="12sp" /></LinearLayout>

dataListType的 0,1,2 分别对应三种不同的布局赋值,XML文件我就不全部发出来了,这里可以自主发挥。

http://www.mmbaike.com/news/96930.html

相关文章:

  • 哈尔滨网站建设方案开发专业seo公司
  • 政务公开和网站建设情况总结搜索引擎优化方法有哪几种
  • asp网站后台管理系统下载学seo的培训学校
  • 合规部对于网站建设的意见百度链接收录
  • 广州市番禺区人民政府门户网站企业网站seo方案案例
  • 做网站的公司天津百度关键词排名软件
  • 做h5小游戏的网站有哪些宁波网站优化公司价格
  • 永久免费企业网站建设百度秒收录排名软件
  • 珠海网站专业制作怎么做百度网页
  • 桂林设计单位资质升级网站seo包年优化费用
  • app开发网站建设教育培训班
  • 小姐姐做我对象好不好网站网络广告营销方案策划
  • 找公司做网站建设靠谱吗湖南网站推广优化
  • 千华网鞍山门户网站郑州网站推广优化公司
  • 微信手机客户端网站建设求网址
  • 做pc端网站基本流程百度有什么办法刷排名
  • 拉萨北京网站建设seo优化在线诊断
  • 知了网站后台宁波网络营销公司有哪些
  • 长沙网站 微信建设百度网页版下载安装
  • 中国有没有做的好的网站免费正规的接单平台
  • 一个专门做酒店招聘的网站西安seo顾问公司
  • 网站怎么看是谁做的关键词优化公司哪家效果好
  • 个人购买域名做企业网站长春seo技术
  • 公司品牌网站建设价格中国足球世界排名
  • 内蒙古知名网站建设深圳推广公司哪家最好
  • 重庆网站公安备案哪家建设公司网站
  • 网站值不值得做seo优化英语
  • wordpress软件网站模板下载友链之家
  • 适合个人网站广告发布
  • 制作网站建设徐州网站设计