1. ellipsize of TextView
We all know that when ellipsize is set in TextView, the displayed results will be scaled down, but it is worse
By default, Google only displays rows of rows. If you want to display more lines, you must customize TextView.
During the process of repetitive work, I paste this part of the code in the recent project, as shown below:
[Java]
Package com. hustunique. Fuubo. View;
Import android. content. Context;
Import android. util. AttributeSet;
Import android. widget. TextView;
Public class WeiboContentText extends TextView {
Private String mText;
Public WeiboContentText (Context context, AttributeSet attrs ){
Super (context, attrs );
// TODO Auto-generated constructor stub
}
Public WeiboContentText (Context context ){
Super (context );
// TODO Auto-generated constructor stub
}
@ Override
Public CharSequence getText (){
// TODO Auto-generated method stub
Return mText;
}
@ Override
Public void setText (CharSequence text, BufferType ){
// TODO Auto-generated method stub
MText = (String) text;
If (mText. length ()> 22 ){
StringBuffer subTextBuffer = new StringBuffer (mText. substring (0, 19 ));
SubTextBuffer. append ("...");
Text = subTextBuffer;
}
Super. setText (text, type );
}
}
Relatively low, but it feels more practical
2. Try the following methods to solve the layout problem after setting the input method to pop-up:
[Java]
GetWindow (). setSoftInputMode (WindowManager. LayoutParams. xxxx );
3. TextView
<TextView
Android: id = "@ + id/xxx"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: scrollbars = "vertical" <! -- Vertical scroll bar -->
Android: singleLine = "false" <! -- Implement multiple rows -->
Android: maxLines = "12" <! -- Up to 12 rows -->
Android: textColor = "# ffffff"
/>
Of course, we also need to use the setMovementMethod method of TextView to set a rolling instance to make TextView move. The Code is as follows:
TextView TV = (TextView) findViewById (R. id. tvCWJ );
TV. setMovementMethod (ScrollingMovementMethod. getInstance ());
4. The use of setInputType in EditText
This method can be used to hide input content, keyboard content, and so on.
From yunqi yunshu