具有水平线的多行Edittext(Multiline Edittext with Horizontal Lines)
我正在制作一个作业不知道如何添加一个多行的edittext遵循这一个教程,但不知道如何在MainActivity类中实现它
我正在使用以下课程
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
最满意答案
这应该是可能的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.
相关问答
更多-
REST api版本控制(仅版本表示,而不是资源本身)(REST api versioning (only version the representation, not the resource itself))[2022-03-13]
我完全同意; 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 ...
-
版本化特定记录(Versioning specific records)[2022-02-22]
以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 ... -
CQRS中的事件版本控制(Event versioning in CQRS)[2021-12-17]
通常您只需要对事件进行版本管理,您可以忽略这些命令,因为您没有将它们存储在事件存储中。 实现版本控制的方法很少..我的方法很简单: [Obsolete] public class CompanyCreated { public Guid Id { get; set; } public string Name { get; set; } } public class CompanyCreated_V2 { public Guid Id { get; set; } public ... -
版本控制机特定配置(Versioning machine specific configs)[2022-05-14]
我对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 ...