本文整理了Java中android.text.Layout.getEllipsisCount()
方法的一些代码示例,展示了Layout.getEllipsisCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Layout.getEllipsisCount()
方法的具体详情如下:
包路径:android.text.Layout
类名称:Layout
方法名:getEllipsisCount
暂无
代码示例来源:origin: stackoverflow.com
Layout l = textview.getLayout();
if (l != null) {
int lines = l.getLineCount();
if (lines > 0)
if (l.getEllipsisCount(lines-1) > 0)
Log.d(TAG, "Text is ellipsized");
}
代码示例来源:origin: facebook/litho
/**
* @param layout A prepared text layout object
* @return The (zero-indexed) line number at which the text in this layout will be ellipsized, or
* -1 if no line will be ellipsized.
*/
private static int getEllipsizedLineNumber(Layout layout) {
for (int i = 0; i < layout.getLineCount(); ++i) {
if (layout.getEllipsisCount(i) > 0) {
return i;
}
}
return -1;
}
代码示例来源:origin: stackoverflow.com
Layout layout = textview1.getLayout();
if(layout != null) {
int lines = layout.getLineCount();
if(lines > 0) {
int ellipsisCount = layout.getEllipsisCount(lines-1);
if ( ellipsisCount > 0) {
Log.d(TAG, "Text is ellipsized");
}
}
}
代码示例来源:origin: stackoverflow.com
final int lineCount = layout.getLineCount();
if (lineCount > 0) {
final int ellipsisCount = layout.getEllipsisCount(lineCount - 1);
if (ellipsisCount > 0) {
代码示例来源:origin: stackoverflow.com
ViewTreeObserver vto = textview.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Layout l = textview.getLayout();
if ( l != null){
int lines = l.getLineCount();
if ( lines > 0)
if ( l.getEllipsisCount(lines-1) > 0)
Log.d(TAG, "Text is ellipsized");
}
}
});
代码示例来源:origin: stackoverflow.com
ViewTreeObserver vto = textview.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Layout l = textview.getLayout();
if ( l != null){
int lines = l.getLineCount();
if ( lines > 0)
if ( l.getEllipsisCount(lines-1) > 0)
Log.d(TAG, "Text is ellipsized");
}
}
});
代码示例来源:origin: stackoverflow.com
ViewTreeObserver vto = textview.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Layout l = textview.getLayout();
if ( l != null){
int lines = l.getLineCount();
if ( lines > 0)
if ( l.getEllipsisCount(lines-1) > 0)
Log.d(TAG, "Text is ellipsized");
}
}
});
代码示例来源:origin: stackoverflow.com
ViewTreeObserver vto = msg.getViewTreeObserver();
vto.addOnPreDrawListener(new OnPreDrawListener() {
@Override
public boolean onPreDraw() {
// TODO Auto-generated method stub
Layout l = msg.getLayout();
if ( l != null){
int lines = l.getLineCount();
if ( lines > 0)
if ( l.getEllipsisCount(lines-1) > 0){
txtMore.setVisibility(View.VISIBLE); msg.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
}
return true;
}
});
代码示例来源:origin: stackoverflow.com
timestampText = (TextView) findViewById(R.id.text_timestamp);
timestampText.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Layout l = timestampText.getLayout();
if (l != null) {
for (int i = 0; i < l.getLineCount(); ++i) {
if (l.getEllipsisCount(i) > 0) {
timestampText.setVisibility(View.INVISIBLE);
return;
}
}
timestampText.setVisibility(View.VISIBLE);
}
}
});
代码示例来源:origin: stackoverflow.com
if (lineCount > 0)
int ellipsisCount = layout.getEllipsisCount(lineCount - 1);
while (ellipsisCount > 0)
ellipsisCount = layout.getEllipsisCount(lineCount - 1);
代码示例来源:origin: stackoverflow.com
TextView textView=(TextView) yourtextviewId;
Layout l = textView.getLayout();
if ( l != null){
int lines = l.getLineCount();
if ( lines > 0)
if ( l.getEllipsisCount(lines-1) > 0)
Toast.makeText(getApplicationContext(), textView.getText().toString(), Toast.LENGTH_LONG).show();
}
代码示例来源:origin: rockon999/LeanbackLauncher
private boolean isEllipsized() {
Layout l = getLayout();
if (l == null) {
return false;
}
int lines = l.getLineCount();
if (lines <= 0 || l.getEllipsisCount(lines - 1) <= 0) {
return false;
}
return true;
}
}
代码示例来源:origin: MoMoWait/LeanbackLauncher
private boolean isEllipsized() {
boolean z = false;
Layout l = getLayout();
if (l != null) {
int lines = l.getLineCount();
if (lines > 0) {
if (l.getEllipsisCount(lines - 1) > 0) {
z = true;
}
return z;
}
}
return false;
}
}
代码示例来源:origin: easefun/polyv-android-sdk-2.0-demo
@Override
public void onGlobalLayout() {
Layout layout = tv_sum.getLayout();
int lines = layout.getLineCount();
if (lines > 3 || (lines > 0 && layout.getEllipsisCount(lines - 1) > 0)) {
tv_expand.setVisibility(View.VISIBLE);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
tv_sum.getViewTreeObserver().removeOnGlobalLayoutListener(this);
else
tv_sum.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
});
代码示例来源:origin: stackoverflow.com
public static boolean isTextTruncated( String text, TextView textView )
{
if ( textView != null && text != null )
{
Layout layout = textView.getLayout();
if ( layout != null )
{
int lines = layout.getLineCount();
if ( lines > 0 )
{
int ellipsisCount = layout.getEllipsisCount( lines - 1 );
if ( ellipsisCount > 0 )
{
return true;
}
}
}
}
return false;
}
代码示例来源:origin: stackoverflow.com
mTextView.getViewTreeObserver().addOnGlobalLayoutListener(
new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
showHideMoreButton(mTextView);
}
});
public void showHideMoreButton(TextView mTextView) {
Layout layout = mTextView.getLayout();
if (layout != null) {
int lines = layout.getLineCount();
if (lines > 0) {
int ellipsisCount = layout.getEllipsisCount(lines - 1);
if (ellipsisCount > 0) {
mShowMoreButton.setVisibility(View.VISIBLE);
}
}
}
}
代码示例来源:origin: stackoverflow.com
result = layout.getEllipsisCount(index) > 0;
代码示例来源:origin: stackoverflow.com
final int lineCount = layout.getLineCount();
if (lineCount > 0) {
final int ellipsisCount = layout.getEllipsisCount(lineCount - 1);
if (ellipsisCount > 0) {
boolean resize = true;
内容来源于网络,如有侵权,请联系作者删除!