gpt4 book ai didi

java - 如何将 EditText 转换为可编辑文本文件(如记事本)

转载 作者:行者123 更新时间:2023-12-01 09:22:14 26 4
gpt4 key购买 nike

我的问题是,当我的 ScrollViewEditText 出现空白屏幕时。我希望我的应用程序允许用户随时随地编写他/她想要的内容,但是当我运行该应用程序时,您只能在中间输入。 (我拉伸(stretch)了 EditText 以覆盖整个屏幕)

这是我的屏幕:

enter image description here

这是我应该/需要的屏幕:

enter image description here

这是代码:

 <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
android:fitsSystemWindows="true"
tools:context="onhar.personalnote.Writing_Table">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">

<ScrollView
android:layout_width="match_parent"
android:layout_height="1000dp">

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="1000dp">



</RelativeLayout>

</ScrollView>

</RelativeLayout>

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@drawable/plusicon" />

<include layout="@layout/content_writing__table" />

</android.support.design.widget.CoordinatorLayout>

这可能吗?

最佳答案

在 XML 中,您的 EditText 上需要 android:gravity="top|start"

如果您想在 Java 代码中执行此操作,则为:myEditText.setGravity(Gravity.TOP | Gravity.START);

关于java - 如何将 EditText 转换为可编辑文本文件(如记事本),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40099660/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com