Có, đây là một câu hỏi phát triển edittext khác trên SO. Và vâng tôi đã trải qua tất cả những câu hỏi phát triển edittext. Nhưng cái này hơi cụ thể.Android edittext tự động phát triển với văn bản và đẩy mọi thứ xuống
UI:
Một cách bố trí đơn giản với android EditText và nút bên dưới nó. Khi văn bản ít hơn, giao diện edittext vẫn bao phủ toàn bộ màn hình để lại khoảng trống cho nút bên dưới.
Khi người dùng bắt đầu nhập văn bản, edittext sẽ phát triển theo chiều dọc để phù hợp với văn bản. Đồng thời, nút cũng nên tiếp tục đẩy xuống để cho edittext phát triển.
Người dùng có thể cuộn dọc qua màn hình để xem toàn văn.
UI sau khi nhập văn bản quan trọng:
Dưới đây là cách bố trí với EditText và nút bên dưới:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background"
android:clipToPadding="false"
android:fadingEdge="none"
android:fillViewport="true"
android:padding="13dp"
android:scrollbarStyle="outsideOverlay" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<!-- some fixed width image -->
<ImageView
android:id="@+id/someimage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:src="@drawable/page_white_text" />
<EditText
android:id="@+id/some"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/someimage"
android:background="@null"
android:gravity="top"
android:minLines="10"
android:minHeight="50dp"
android:textColor="#222222"
android:textSize="15dp"
android:typeface="serif" >
<requestFocus />
</EditText>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:baselineAligned="true"
android:layout_marginTop="5dp"
android:padding="10dp"
android:orientation="vertical" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
này hoạt động nhiều hơn hoặc ít hơn. Nhưng khi tôi nhập nhiều văn bản, thay vì nhấn nút xuống dưới. Nó đi đằng sau nó thích:
Bất kỳ trợ giúp ở đây được nhiều đánh giá cao. Cảm ơn :)
Hi Vinit, vui lòng xem nhận xét về trên ans. –