Giter Club home page Giter Club logo

Comments (18)

MZCretin avatar MZCretin commented on August 18, 2024

点不出来是什么意思 @zhangqifan1

from expandabletextview.

zhangqifan1 avatar zhangqifan1 commented on August 18, 2024

图片

from expandabletextview.

zhangqifan1 avatar zhangqifan1 commented on August 18, 2024

大佬,是不是我需要设置什么,这里掉不出来 展开 和 收回的 监听

from expandabletextview.

MZCretin avatar MZCretin commented on August 18, 2024

你是不是给TextView设置了点击事件了 @zhangqifan1

from expandabletextview.

zhangqifan1 avatar zhangqifan1 commented on August 18, 2024

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

/**

  • 正常的使用
    */
    ExpandableTextView expandableTextView = findViewById(R.id.expand_tv);
    //需要显示的内容
    String yourText = " 我所认识的**,强大、友好。@奥特曼 “一带一路”经济带带动了沿线国家的经济发展,促进我国与他国的友好往来和贸易发展,可谓“双赢”。http://www.baidu.com 自古以来,**以和平、友好的面孔示人。汉武帝派张骞出使西域,开辟丝绸之路,增进与西域各国的友好往来。http://www.baidu.com 胡麻、胡豆、香料等食材也随之传入**,汇集于中华美食。@rng 漠漠古道,驼铃阵阵,这条路奠定了“一带一路”的基础,让世界认识了**。";
    //将内容设置给控件
    expandableTextView.setContent(yourText);
    //xml中的属性也可以通过代码设置 比如
    expandableTextView.setNeedExpend(true);
    //还有很多。。。。
    //添加点击监听
    expandableTextView.setLinkClickListener(new ExpandableTextView.OnLinkClickListener() {
    @OverRide
    public void onLinkClickListener(LinkType linkType, String content, String selfContent) {
    //根据类型去判断
    if (linkType.equals(LinkType.LINK_TYPE)) {
    Toast.makeText(MainActivity.this, "你点击了链接 内容是:" + content, Toast.LENGTH_SHORT).show();
    } else if (linkType.equals(LinkType.MENTION_TYPE)) {
    Toast.makeText(MainActivity.this, "你点击了@用户 内容是:" + content, Toast.LENGTH_SHORT).show();
    } else if (linkType.equals(LinkType.SELF)) {
    Toast.makeText(MainActivity.this, "你点击了自定义规则 内容是:" + content + " " + selfContent, Toast.LENGTH_SHORT).show();
    }
    }
    });

    //添加展开和收回操作
    expandableTextView.setExpandOrContractClickListener(type -> {
    if (type.equals(StatusType.STATUS_CONTRACT)) {
    Toast.makeText(MainActivity.this, "收回操作", Toast.LENGTH_SHORT).show();
    } else {
    Toast.makeText(MainActivity.this, "展开操作", Toast.LENGTH_SHORT).show();
    }
    });

}

}

from expandabletextview.

zhangqifan1 avatar zhangqifan1 commented on August 18, 2024

就这些了 ...

from expandabletextview.

zhangqifan1 avatar zhangqifan1 commented on August 18, 2024

图片

from expandabletextview.

MZCretin avatar MZCretin commented on August 18, 2024

是点了没有弹toast吗
@zhangqifan1

from expandabletextview.

zhangqifan1 avatar zhangqifan1 commented on August 18, 2024

不是,我没有这个方法啊,,

from expandabletextview.

zhangqifan1 avatar zhangqifan1 commented on August 18, 2024

图片

from expandabletextview.

MZCretin avatar MZCretin commented on August 18, 2024

好吧 我看下 @zhangqifan1

from expandabletextview.

MZCretin avatar MZCretin commented on August 18, 2024

你可以用下1.5.2版本

from expandabletextview.

MZCretin avatar MZCretin commented on August 18, 2024

我刚刚检查了下 是有的 你检查下你是不是版本弄错了 @zhangqifan1

from expandabletextview.

zhangqifan1 avatar zhangqifan1 commented on August 18, 2024

大佬,1.5.2可以,你的1.5.3可以么?

from expandabletextview.

zhangqifan1 avatar zhangqifan1 commented on August 18, 2024

我重启下studio吧

from expandabletextview.

MZCretin avatar MZCretin commented on August 18, 2024

恩恩

from expandabletextview.

zhangqifan1 avatar zhangqifan1 commented on August 18, 2024

哈哈,好了,可以了谢谢大佬

from expandabletextview.

zhangqifan1 avatar zhangqifan1 commented on August 18, 2024

可以调出来了

from expandabletextview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.