Giter Club home page Giter Club logo

textviewflowlayout's Introduction

TextViewFlowLayout

Whatsapp and Telegram message layout

If you are wondering how WhatsApp and Telegram handle the time shown in every message.

For those who don't know:

  1. If the message is very short, the text and time are in the same row.
  2. If the message is long, the time is in the bottom right corner - the text wrapped around it.

Extended FrameLayout that wrap its content when there is no place in the current line.

Demonstration

Usage

In your layout use TextViewFlowLayout as your TextView parent layout:

<com.example.textviewflowlayout.TextViewFlowLayout
    android:layout_width="220dp"
    android:layout_height="wrap_content"
    android:paddingStart="4dp"
    android:paddingEnd="4dp"
    android:paddingBottom="4dp">
    
    <TextView
            android:id="@+id/message"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="start"
            android:maxWidth="220dp"
            android:paddingStart="4dp"
            android:paddingEnd="4dp"
            android:text='@{item.message}'
            tools:text="Hello World!"
            tools:visibility="visible" />

        <androidx.appcompat.widget.AppCompatTextView
            android:id="@+id/time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end"
            android:gravity="end"
            android:paddingStart="8dp"
            android:paddingEnd="4dp"
            android:text="12:45 AM"
            android:textSize="10sp"
            tools:ignore="SmallSp"
            tools:text="22:02 AM" />

    </com.example.textviewflowlayout.TextViewFlowLayout>

textviewflowlayout's People

Contributors

farshidabz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

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.