Skip to content

Commit

Permalink
新增获取输入内容方法
Browse files Browse the repository at this point in the history
  • Loading branch information
fengt committed Jan 16, 2017
1 parent bc30e6a commit c0c109d
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 56 deletions.
6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ public FJEditTextCount setEtMinHeight(int px){
return this;
}

/**
* 获取输入内容
* @return 内容
*/
public String getText(){
return etContent.getText().toString();
}

private TextWatcher mTextWatcher = new TextWatcher() {
private int editStart;
private int editEnd;
Expand Down
46 changes: 0 additions & 46 deletions README-En.md

This file was deleted.

12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@
|:-------------:|:-------------:|
| ![百分比类型.gif](http://upload-images.jianshu.io/upload_images/2071764-b45df6bf1d00205e.gif) | ![单数类型.gif](http://upload-images.jianshu.io/upload_images/2071764-7be37be47251b7d4.gif) |

> ### 用法:
> #### 更新1.0.2版本
新增获取输入内容的方法:

fjEdit.getText();

> #### 以下1.0.1版本
> #### 用法:
1.引用

Expand Down Expand Up @@ -42,5 +50,3 @@
.show();
> #### [博客地址](http://www.jianshu.com/p/383ba123c201)
> [English](https://github.com/FTandJYQ/AnFQNumEditText/blob/master/README-En.md)|[中文](https://github.com/FTandJYQ/AnFQNumEditText/blob/master/README.md)
17 changes: 16 additions & 1 deletion app/src/main/java/fj/edittextcount/test/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package fj.edittextcount.test;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import fj.edittextcount.lib.FJEditTextCount;

/**
* ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
* ┃ ╭﹉﹊﹉╮ ╔═════╗╔═════╗╔═════╗┃
Expand All @@ -18,17 +22,28 @@
public class MainActivity extends AppCompatActivity {

private FJEditTextCount fjEdit;
private Button btnGetText;
private TextView tvText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fjEdit = (FJEditTextCount) findViewById(R.id.fjEdit);
btnGetText = (Button) findViewById(R.id.btnGetText);
tvText = (TextView) findViewById(R.id.tvText);
fjEdit.setEtHint("内容")//设置提示文字
.setEtMinHeight(200)//设置最小高度,单位px
.setLength(50)//设置总字数
//TextView显示类型(SINGULAR单数类型)(PERCENTAGE百分比类型)
.setType(FJEditTextCount.SINGULAR)
.setLineColor("#3F51B5")//设置横线颜色
.show();

btnGetText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
tvText.setText(fjEdit.getText());
}
});
}
}
12 changes: 12 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,16 @@
android:id="@+id/fjEdit"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

<Button
android:id="@+id/btnGetText"
android:layout_below="@+id/fjEdit"
android:text="获取输入内容"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tvText"
android:layout_below="@+id/btnGetText"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>

0 comments on commit c0c109d

Please sign in to comment.