首页 \ 问答 \ 具有水平线的多行Edittext(Multiline Edittext with Horizontal Lines)

具有水平线的多行Edittext(Multiline Edittext with Horizontal Lines)

我正在制作一个作业不知道如何添加一个多行的edittext遵循这一个教程,但不知道如何在MainActivity类中实现它

在edittext中绘制多行,例如记事本

我正在使用以下课程

public class LinedEditText extends EditText {

    private Rect mRect;
    private Paint mPaint;

    // we need this constructor for LayoutInflater
    public LinedEditText(Context context, AttributeSet attrs) {
        super(context, attrs);

        mRect = new Rect();
        mPaint = new Paint();
        mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
      //  mPaint.setColor(getResources().getColor()); //SET YOUR OWN COLOR HERE
    }

    @Override
    protected void onDraw(Canvas canvas) {
        //int count = getLineCount();

        int height = getHeight();
        int line_height = getLineHeight();

        int count = height / line_height;

        if (getLineCount() > count)
            count = getLineCount();//for long text with scrolling

        Rect r = mRect;
        Paint paint = mPaint;
        int baseline = getLineBounds(0, r);//first line

        for (int i = 0; i < count; i++) {

            canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint);
            baseline += getLineHeight();//next line
        }

        super.onDraw(canvas);
    }

}

我有以下xml视图想要通过这个类inflat它们

activity_main.xml中

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:id="@+id/main_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

</LinearLayout>

multilinedittext.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/multiline_exdittext_layout"
    android:layout_width="match_parent" android:layout_height="match_parent">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:inputType="textMultiLine"
        android:ems="10"
        android:id="@+id/edittxt_multilines"
        />

</LinearLayout>

I am making a Assignment don't know how to add a multilines edittext follow this one Tutorial but don't know how to implement it in MainActivity class

Drawing multiple lines in edittext e.g. notepad

i am using following class

public class LinedEditText extends EditText {

    private Rect mRect;
    private Paint mPaint;

    // we need this constructor for LayoutInflater
    public LinedEditText(Context context, AttributeSet attrs) {
        super(context, attrs);

        mRect = new Rect();
        mPaint = new Paint();
        mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
      //  mPaint.setColor(getResources().getColor()); //SET YOUR OWN COLOR HERE
    }

    @Override
    protected void onDraw(Canvas canvas) {
        //int count = getLineCount();

        int height = getHeight();
        int line_height = getLineHeight();

        int count = height / line_height;

        if (getLineCount() > count)
            count = getLineCount();//for long text with scrolling

        Rect r = mRect;
        Paint paint = mPaint;
        int baseline = getLineBounds(0, r);//first line

        for (int i = 0; i < count; i++) {

            canvas.drawLine(r.left, baseline + 1, r.right, baseline + 1, paint);
            baseline += getLineHeight();//next line
        }

        super.onDraw(canvas);
    }

}

and i have following xml view wanted to inflat them via this class

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:id="@+id/main_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

</LinearLayout>

multilinedittext.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/multiline_exdittext_layout"
    android:layout_width="match_parent" android:layout_height="match_parent">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:inputType="textMultiLine"
        android:ems="10"
        android:id="@+id/edittxt_multilines"
        />

</LinearLayout>

原文:https://stackoverflow.com/questions/33341541
更新时间:2023-12-04 13:12

最满意答案

这应该是可能的OTB。

我自己没有尝试过,但是有一个名为excludedOnUpdateProps (虽然定义了Java bean)的属性,如下所述:

https://community.alfresco.com/docs/DOC-4821-versioning-behaviour

如果您要尝试一下,我会很感激它是否真的有效。


This should be possible OTB.

I haven't tried it myself, but there's a property called excludedOnUpdateProps (Java bean defined, though), described here:

https://community.alfresco.com/docs/DOC-4821-versioning-behaviour

If you're going to try it out, I'd appreciate feedback on whether it actually works.

相关问答

更多
  • 我完全同意; URI表示身份,当引入新版本时,身份不会更改。 可能有其他概念的新URI,当然,现有的URI可能会重定向...但在URI中包含“v2”,将RPCish告诉我。 请注意,这与REST无关,实际上,从REST角度来看,它只是字符。 I completely agree; a URI expresses identity, identity doesn't change when a new version is introduced. There might be new URIs for add ...
  • 鉴于您有一篇文章更改其版本,还原: article = Article.find("the-id") article.attributes = article.versions.where(version: 0).first.attributes article.save 请注意,这只会在版本列表中添加新版本,并将其放在堆栈顶部。 列出所有版本: article.versions 要显示特定修订: article.versions.where(version: 4).first Given you h ...
  • Web部件不是特定于页面的,它们特定于页面模板。 窗口小部件特定于页面,但基于Web部件,Web部件没有版本历史记录。 因此,您在页面模板上有版本历史记录,因此如果更改了Web部件配置,则会使用页面模板的历史记录。 如此简短的回答是,您无法在页面上的Web部件上应用版本控制,因为它不存在。 Web parts are NOT specific to pages, they ARE specific to page templates. Widgets are specific to pages but ar ...
  • 我通过在“中间”创建模型来解决这样的问题,例如“ItemReference”MongoDB是文档存储而不是关系数据库,因此在必要时存储重复信息是合法的。 MongoDB能够存储嵌入式文档,因此我们将使用这个强大的功能。 ItemReference包含创建视图所需的有关Item的所有重要信息。 这减少了视图端的查询,但增加了插入/更新端的查询。 问题是你需要一个由item_id和版本号组成的“复合主键”。 我们来谈谈代码: 物品型号: class Item include Mongoid::Documen ...
  • 应用程序中有几个图层。 事实证明,为了提交更改,您应该将参数存储在项目级别,这些参数将更改存储在* .csproj文件中。 There are several layers in the application. It turns out that, in order to commit the changes, you should store the parameters at project level which stores the changes in the *.csproj file.
  • 这应该是可能的OTB。 我自己没有尝试过,但是有一个名为excludedOnUpdateProps (虽然定义了Java bean)的属性,如下所述: https://community.alfresco.com/docs/DOC-4821-versioning-behaviour 如果您要尝试一下,我会很感激它是否真的有效。 This should be possible OTB. I haven't tried it myself, but there's a property called exclu ...
  • 以FirebirdFAQ为例,您可以执行以下操作: SELECT a.column1, a.column2, COUNT(b.column1) + 1 AS "rank" FROM theTable a LEFT JOIN theTable b ON a.column1 = b.column1 AND b.column2 < a.column2 GROUP BY 1, 2 在即将到来的Firebird 3中,您可以使用RANK()或ROW_NUMBER()等Windows功能: SELECT column ...
  • 通常您只需要对事件进行版本管理,您可以忽略这些命令,因为您没有将它们存储在事件存储中。 实现版本控制的方法很少..我的方法很简单: [Obsolete] public class CompanyCreated { public Guid Id { get; set; } public string Name { get; set; } } public class CompanyCreated_V2 { public Guid Id { get; set; } public ...
  • 我对php不是很熟悉,但我想你可能有一个全局的config.php文件,其中可能包含(require?) config..php文件。 这样所有配置文件都将受版本控制,但不存在冲突。 PHP应该有一些方法来确定当前机器的主机名,然后加载适当的配置文件。 生成的存储库布局可能如下所示 / /config.php /config.web_server.php /config.pc_A.php /config.pc_B.php I'm not very familiar with php, ...
  • 大多数开发人员未能在代码中提交正确的汇编版本。 让我们说如果你有40个项目和15个开发人员,那么维护[assembly: AssemblyVersion("1.0.*")]版本将永远是一个问题。 我建议您可以签出代码并执行搜索和替换以始终注入正确的程序集内部版本号,如[Major.Minor.Build]。 [Major.Minor]被视为输入并且全局意识到团队因此减少了坏的dll编号/内部编号可以正向增加并与CI的编号匹配以进行跟踪。 SVN提交号也可以与它混合使用。 Mostly developers ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。