【问题标题】:Does anyone know what is this called?有谁知道这叫什么?
【发布时间】:2016-07-07 07:26:41
【问题描述】:

最初的用户界面如下

点击编辑 TextView 后,它出现在键盘上

如何实现相同的用户界面?有图书馆吗?

【问题讨论】:

标签: android


【解决方案1】:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".activity.ChatActivity"
    tools:showIn="@layout/activity_chat">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingBottom="50dp"
        android:scrollbars="vertical" />

    <LinearLayout
        android:background="@android:color/white"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal"
        android:weightSum="4">

        <EditText android:id="@+id/message"
            android:layout_width="0dp"
            android:hint="Enter message"
            android:paddingLeft="10dp"
            android:background="@null"
            android:layout_marginRight="10dp"
            android:layout_marginLeft="16dp"
            android:lines="1"
            android:layout_height="wrap_content"
            android:layout_weight="3" />

        <Button android:id="@+id/btn_send"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:background="@null"
            android:text="SEND"
            android:textSize="16dp"
            android:textColor="@color/colorPrimary" />

    </LinearLayout>

</RelativeLayout>

【讨论】:

    【解决方案2】:

    Here 是一个 GitHub 存储库,其中包含有关如何实现它的教程。如果您访问 XML 代码,您将看到与 cmets 和先前答案中提供的代码类似。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-13
      • 2012-09-08
      • 2014-08-28
      • 2014-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多