指定textview中的某部分进行点击

news/2024/7/7 12:08:42
                      CharSequence str="没有任何数据,请登录!";
SpannableString spannableString1 = new SpannableString(str);
spannableString1.setSpan(new ClickableSpan(){
@Override
public void onClick(View widget) {
Intent intent=new Intent(getActivity(),LoginActivity.class);
startActivity(intent);
}
}, str.length()-4, str.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
spannableString1.setSpan(new ForegroundColorSpan(Color.RED),str.length()-4, str.length(),Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
no_charge_recode.setText(spannableString1);
no_charge_recode.setMovementMethod(LinkMovementMethod.getInstance());

http://www.niftyadmin.cn/n/3649341.html

相关文章

Android重力感应代码例子

android中的很多游戏的游戏都使用了重力感应的技术,就研究了一下重力感应 以屏幕的左下方为原点,箭头指向的方向为正。从-10到10,以浮点数为等级单位,想象以下情形: 手机屏幕向上(z轴朝天)水平…

react中创建一个组件_如何在React中创建社交关注组件

react中创建一个组件介绍 (Introduction) When you’re building a web site, you’ll often want to share your Social Media accounts for visitors to follow. In this tutorial, you’ll create a Social Follow component in React, using the social media icons provid…

软件框架之imageloader的使用

Imageloader的使用 一、特点: 1)多线程下载图片,图片可以来源于网络,文件系统,项目文件夹assets中以及drawable中等 2)支持随意的配置ImageLoader,例如线程池,图片下载器&#xff…

实验三(OSPF)7 8

解题思路: 先配置好路由的环回及规划好IP地址,确保正确; (由于r8模拟为运营商,因此r1,r2,r3各写一条缺省指向r8 并测试) hub-spoke网络结构,需要在r1-r2-r3建立隧道0配置MGRE-多点通用路由协…

HarmonyOS 2.0 手机版使用初体验 ——手机开发者 (Beta版)

12月16日上午10点,华为在北京举办华为开发者日暨HarmonyOS2.0手机开发者Beta版发布活动。华为此次宣布面向手机开发者开放完整的HarmonyOS 2.0系统能力、丰富的API(应用开发接口),以及强大的开发工具DevEco Studio等技术装备&…

angular4前后端分离_如何在Angular 4+中使用Apollo客户端GraphQL

angular4前后端分离Apollo Client is the flexible, community-driven GraphQL client for Angular, JavaScript, and native platforms. It is designed from the ground up to make it easy to build UI components that fetch data with GraphQL. This article is a quick s…

软件框架之ButterKnife的使用

1、简介ButterKnife是注解中相对简单易懂的很不错的开源框架1.强大的View绑定和Click事件处理功能,简化代码,提升开发效率2.方便的处理Adapter里的ViewHolder绑定问题3.运行时不会影响APP效率,使用配置方便4.代码清晰,可读性强2、…