本文整理汇总了Java中android.widget.TextView.length方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.length方法的具体用法?Java TextView.length怎么用?Java TextView.length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TextView
的用法示例。
在下文中一共展示了TextView.length方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onTextChanged
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void onTextChanged(CharSequence s, int start, int before, int count)
{
TextView text = (TextView)getCurrentFocus();
// Can't be sure if we got the right slot, but move focus to
// the next one if there is a letter in the slot
if (text != null && text.length() > 0)
{
View next = text.focusSearch(View.FOCUS_RIGHT);
if (next != null)
next.requestFocus();
doSearch();
}
}
示例2: truncateText
import android.widget.TextView; //导入方法依赖的package包/类
private void truncateText(@Nullable TextView textView, int maxLength) {
if (textView != null) {
if (textView.length() > maxLength) {
String text = (String) textView.getText();
String newText = text.substring(0, maxLength) + "...";
textView.setText(newText);
}
}
}
示例3: onEditorAction
import android.widget.TextView; //导入方法依赖的package包/类
public boolean onEditorAction(TextView view, int actionId, KeyEvent event)
{
// Check id
switch (actionId)
{
// Do a dictionary search if there is a letter in the slot
case EditorInfo.IME_ACTION_NEXT:
if (view.length() > 0 && !data.getSearching())
doSearch();
break;
}
return false;
}
示例4: doSearch
import android.widget.TextView; //导入方法依赖的package包/类
private void doSearch()
{
// Build a match string
StringBuilder buffer = new StringBuilder();
boolean empty = true;
for (int i = 0; i < length; i++)
{
TextView text = (TextView)letters.getChildAt(i);
// If there is a letter in the slot
if (text.length() > 0)
{
String letter = text.getText().toString();
buffer.append(letter.toLowerCase(Locale.getDefault()));
empty = false;
}
// Wildcard
else
buffer.append(".");
}
// Don't search if no letters
if (empty)
return;
// Match string
String match = buffer.toString();
// Start search task
if (data != null)
{
data.startSearchTask(match, wordList);
search.setEnabled(false);
}
}
示例5: isValid
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public boolean isValid(TextView view) {
return view.length() <= value;
}
示例6: isValid
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public boolean isValid(TextView view) {
return view.length() >= value;
}