diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser index 8d80635..64aa1bd 100644 Binary files a/.idea/caches/gradle_models.ser and b/.idea/caches/gradle_models.ser differ diff --git a/app/src/main/java/com/cretin/www/expandabletextview/MainActivity.java b/app/src/main/java/com/cretin/www/expandabletextview/MainActivity.java index 1e7df75..7fa016f 100644 --- a/app/src/main/java/com/cretin/www/expandabletextview/MainActivity.java +++ b/app/src/main/java/com/cretin/www/expandabletextview/MainActivity.java @@ -67,7 +67,7 @@ public class MainActivity extends AppCompatActivity { }; private void initView() { - views = new ExpandableTextView[11]; + views = new ExpandableTextView[12]; tips = new TextView[11]; views[0] = findViewById(R.id.ep_01); views[1] = findViewById(R.id.ep_02); @@ -80,6 +80,7 @@ private void initView() { views[8] = findViewById(R.id.ep_09); views[9] = findViewById(R.id.ep_10); views[10] = findViewById(R.id.ep_11); + views[11] = findViewById(R.id.ep_12); tips[0] = findViewById(R.id.tv_tips01); tips[1] = findViewById(R.id.tv_tips02); tips[2] = findViewById(R.id.tv_tips03); @@ -135,6 +136,8 @@ private void setContent(String yourText, boolean d) { //2、正常带链接,不带@用户,有展开和收回功能,有切换动画 views[1].setContent(yourText); views[1].setLinkClickListener(linkClickListener); + views[11].setContent(yourText); + views[11].setLinkClickListener(linkClickListener); //添加展开和收回操作 views[1].setExpandOrContractClickListener(type -> { if (type.equals(StatusType.STATUS_CONTRACT)) { @@ -143,6 +146,14 @@ private void setContent(String yourText, boolean d) { Toast.makeText(MainActivity.this, "展开操作", Toast.LENGTH_SHORT).show(); } }); + //添加展开和收回操作 只触发点击 不真正触发展开和收回操作 + views[11].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(); + } + },false); //3、正常不带链接,不带@用户,有展开和收回功能,有切换动画 views[2].setContent(yourText); diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 3536e4c..17f436f 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -113,6 +113,18 @@ app:ep_need_expand="true" app:ep_need_mention="false" /> + +