一个支持选词的 TextView,类似与单词 app 中点击单词翻译的效果

qtmv9972 7年前
   <h2><strong>GetWordTextView</strong></h2>    <p>A TextView that can get word in it's content by click,and you can set HighlightText also. (Support English and Chinese)</p>    <p style="text-align:center"><img src="https://simg.open-open.com/show/094887af8259fb74b5ca8d994c7b176c.gif"></p>    <h2><strong>Usage</strong></h2>    <h3><strong>Add GetWordTextView to your layout:</strong></h3>    <pre>  <code class="language-java"><me.solidev.library.GetWordTextView xmlns:app="http://schemas.android.com/apk/res-auto"          android:id="@+id/english_get_word_text_view"          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:textSize="16sp"          app:highlightColor="@color/colorAccent"          app:highlightText="that"          app:language="English"          app:selectedColor="@color/colorPrimary" /></code></pre>    <ul>     <li>highlightText :HighlightText</li>     <li>highlightColor :HighlightText'color</li>     <li>selectedColor :Clicked word's background</li>     <li>language :Content's language</li>    </ul>    <h3><strong>Set Text and Listener in your code</strong></h3>    <pre>  <code class="language-java">mEnglishGetWordTextView = (GetWordTextView) findViewById(R.id.english_get_word_text_view);          mEnglishGetWordTextView.setText("A view that can get every word inside,it's very helpful view!");          mEnglishGetWordTextView.setOnWordClickListener(new GetWordTextView.OnWordClickListener() {              @Override              public void onClick(String word) {                  showToast(word);              }          });</code></pre>    <h2><strong>TODO</strong></h2>    <p>Mixed support for English and Chinese</p>    <h2><strong>Contact & Help</strong></h2>    <ul>     <li>blog: <a href="/misc/goto?guid=4959724493548779387" rel="nofollow,noindex">http://www.jianshu.com/users/6725c8e8194f</a></li>     <li>weibo: <a href="/misc/goto?guid=4959724493638953054" rel="nofollow,noindex">http://weibo.com/xljiepeng</a></li>     <li>email: <a href="/misc/goto?guid=4959724493726874481" rel="nofollow,noindex">jiapeng1818@163.com</a></li>    </ul>    <h2><strong>License</strong></h2>    <pre>  <code class="language-java">Copyright (C) 2016 [_SOLID](https://github.com/burgessjp)    Licensed under the Apache License, Version 2.0 (the "License");  you may not use this file except in compliance with the License.  You may obtain a copy of the License at        http://www.apache.org/licenses/LICENSE-2.0    Unless required by applicable law or agreed to in writing, software  distributed under the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and  limitations under the License.</code></pre>    <p> </p>    <p> </p>    <p> </p>