GithubHelp home page GithubHelp logo

expandtextview's Introduction

效果图 (带提示图标)

960

效果图 (不带提示图标)

960

activity 文件

ExpandTextView textView;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    textView= (ExpandTextView) findViewById(R.id.cusTextView);
    textView.updateText(getResources().getString(R.string.test_expandtext));
}

xml文件

<widget.ExpandTextView
    android:background="@android:color/white"
    android:id="@+id/cusTextView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="12dp"
    android:paddingLeft="8dp"
    android:paddingRight="8dp"
    android:paddingBottom="8dp"
    android:paddingTop="8dp"
    app:drawableHeight="12dp"
    app:drawableWidth="14dp"
    app:expandDrawable="@mipmap/up"
    app:maxLines="3"
    app:shrinkDrawable="@mipmap/down"
    app:textColor="@android:color/black"
    app:textSize="14sp" />

属性说明

<declare-styleable name="ExpandTextView">
    <!-- 文本颜色 -->
    <attr name="textColor" format="color|reference"/>
    <!-- 最大显示文本行数 -->
    <attr name="maxLines" format="integer|reference"/>
    <!-- 文本字体大小 -->
    <attr name="textSize" format="dimension|reference"/>
    <!-- 动画显示时间-->
    <attr name="animDuration" format="integer|reference"/>
    <!-- 提示图标的宽度 -->
    <attr name="drawableWidth" format="dimension|reference"/>
    <!-- 提示图标的高度 -->
    <attr name="drawableHeight" format="dimension|reference"/>
    <!-- 展开时候的提示图标 -->
    <attr name="expandDrawable" format="color|reference"/>
    <!-- 收缩收起时候的提示图标 -->
    <attr name="shrinkDrawable" format="color|reference"/>
</declare-styleable>

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.