‘壹’ 安卓系统手机使用百度手机输入法如何换行
以华为畅享7手机为例,可以通过以下方法在使用网络输入法时进行换行,步骤如下:
1、打开微信中的一个对话框,点击下面的输入栏进行文字的输入:
‘贰’ android文字自动换行每行文字数固定
只要设定好textview的宽,设具体的数值,,当设的textview的高足够高时,会自动换行并保持每行文字数固定
1) TextView在显示中文的时候 标点符号不能显示在一行的行首和行尾,如果一个标点符号刚好在一行的行尾,该标点符号就会连同前一个字符跳到下一行显示;
2)一个英文单词不能被显示在两行中( TextView在显示英文时,标点符号是可以放在行尾的,但英文单词也不能分开 );
如果只是想让标点符号可以显示在行尾,有一个简单的方法就是在标点符号后加一个空格,则该标点符号就可以显示在行尾了。
‘叁’ android中英文混编字符串如何实现文字自动换行
textView如果想要强制换行的话,必须先把TextView显示方式修改为多行(android:singleLine="false"),然后才能换行。
方法一般用两种:
1、在字符串里加入“\n”,如"abc\nrc";
2、把TextView设置为固定宽度,然后让系统自动换行。如android:layout_width="100dp";
‘肆’ android 代码中如何注释多行
如果对楼主有帮助,可以给个采纳不,谢谢啦
Android:在eclipse中快速多行注释的方法
1.选中你要加注释的区域,用ctrl+shift+C
会加上//注释
2.先把你要注释的东西选中,用shit+ctrl+/
会加上/*
*/注释
3.要修改在eclispe中的命令的快捷键方式我们只需进入windows
->
preference
->
General
->
key设置就行了(转)
补充:选中要加注释的区域,ctrl+/
会加//注释
2010/09/13
选中后,ctrl+shift+/,去掉选中部分的注释
(转)附myeclipse中的所有快捷键列表:
Ctrl+1
快速修复(最经典的快捷键,就不用多说了)
Ctrl+D:
删除当前行
Ctrl+Alt+↓
复制当前行到下一行(复制增加)
Ctrl+Alt+↑
复制当前行到上一行(复制增加)
Alt+↓
当前行和下面一行交互位置(特别实用,可以省去先剪切,再粘贴了)
Alt+↑
当前行和上面一行交互位置(同上)
Alt+←
前一个编辑的页面
Alt+→
下一个编辑的页面(当然是针对上面那条来说了)
Alt+Enter
显示当前选择资源(工程,or
文件
or文件)的属性
Shift+Enter
在当前行的下一行插入空行(这时鼠标可以在当前行的任一位置,不一定是最后)
Shift+Ctrl+Enter
在当前行插入空行(原理同上条)
Ctrl+Q
定位到最后编辑的地方
Ctrl+L
定位在某行
(对于程序超过100的人就有福音了)
Ctrl+M
最大化当前的Edit或View
(再按则反之)
Ctrl+/
注释当前行,再按则取消注释
Ctrl+O
快速显示
OutLine
Ctrl+T
快速显示当前类的继承结构
Ctrl+W
关闭当前Editer
Ctrl+K
参照选中的Word快速定位到下一个
Ctrl+E
快速显示当前Editer的下拉列表(如果当前页面没有显示的用黑体表示)
Ctrl+/(小键盘)
折叠当前类中的所有代码
Ctrl+×(小键盘)
展开当前类中的所有代码
Ctrl+Space
代码助手完成一些代码的插入(但一般和输入法有冲突,可以修改输入法的热键,也可以暂用Alt+/来代替)
Ctrl+Shift+E
显示管理当前打开的所有的View的管理器(可以选择关闭,激活等操作)
Ctrl+J
正向增量查找(按下Ctrl+J后,你所输入的每个字母编辑器都提供快速匹配定位到某个单词,如果没有,则在stutes
line中显示没有找到了,查一个单词时,特别实用,这个功能Idea两年前就有了)
Ctrl+Shift+J
反向增量查找(和上条相同,只不过是从后往前查)
Ctrl+Shift+F4
关闭所有打开的Editer
Ctrl+Shift+X
把当前选中的文本全部变味小写
Ctrl+Shift+Y
把当前选中的文本全部变为小写
Ctrl+Shift+F
格式化当前代码
Ctrl+Shift+P
定位到对于的匹配符(譬如{})
(从前面定位后面时,光标要在匹配符里面,后面到前面,则反之)
下面的快捷键是重构里面常用的,本人就自己喜欢且常用的整理一下(注:一般重构的快捷键都是Alt+Shift开头的了)
Alt+Shift+R
重命名
(是我自己最爱用的一个了,尤其是变量和类的Rename,比手工方法能节省很多劳动力)
Alt+Shift+M
抽取方法
(这是重构里面最常用的方法之一了,尤其是对一大堆泥团代码有用)
Alt+Shift+C
修改函数结构(比较实用,有N个函数调用了这个方法,修改一次搞定)
Alt+Shift+L
抽取本地变量(
可以直接把一些魔法数字和字符串抽取成一个变量,尤其是多处调用的时候)
Alt+Shift+F
把Class中的local变量变为field变量
(比较实用的功能)
Alt+Shift+I
合并变量(可能这样说有点不妥Inline)
Alt+Shift+V
移动函数和变量(不怎么常用)
Alt+Shift+Z
重构的后悔药(Undo)
‘伍’ android textview 怎么换行
textView如果想要强制换行的话,必须先把TextView显示方式修改为多行(android:singleLine="false"),然后才能换行。
方法一般用两种:
1、在字符串里加入“ ”,如"abc rc";
2、把TextView设置为固定宽度,然后让系统自动换行。如android:layout_width="100dp";
(5)android注释换行扩展阅读
Class Overview
向用户显示文本,并可选择允许他们编辑文本。TextView是一个完整的文本编辑器,但是基类为不允许编辑;其子类EditText允许文本编辑。
允许用户复制部分或全部内容,将其粘贴到别的地方,设置XML属性Android:textisselectable :“真” 或设置相关方法 settextisselectable 为“真”。textisselectable flag 允许用户在TextView选择手势,从而触发系统内置的复制/粘贴控件。
Displays text to the user and optionally allows them to edit it. A TextView is a complete text editor, however the basic class is configured to not allow editing; seeEditTextfor a subclass that configures the text view for editing.
To allow users to some or all of the TextView's value and paste it somewhere else, set the XML attributeandroid:textIsSelectableto "true" or callsetTextIsSelectable(true). ThetextIsSelectableflag allows users to make selection gestures in the TextView, which in turn triggers the system's built-in /paste controls.
‘陆’ android 中组件怎么换行
应用中获取会用到需要自动换行的控件,而这并不是一般的线性或者相对布局就能实现的,在此分享下自定义控件。原型是在网上找到的,在此稍作了修改。
这是设计出的样稿,样稿中的较高的图片是从一个数据集中的穿插在另一个数据集中的,Textview的长度需要根据文字的长度不同而设置,而左右需要平分,做法如下:
1.将总体分为两个数据集:左&右,并用2个LinearLayout分别装自定义控件
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:layout_marginTop="5dip">
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</<span style="line-height: 21px;">PredicateLayout>
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<<span style="line-height: 21px;">PredicateLayout android:id="@+id/righttab"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</<span style="line-height: 21px;">PredicateLayout>
2.自定义控件
public class PredicateLayout extends LinearLayout {
int mLeft, mRight, mTop, mBottom;
Hashtable map = new Hashtable();
public PredicateLayout(Context context) {
super(context);
}
public PredicateLayout(Context context, int horizontalSpacing, int verticalSpacing) {
super(context);
}
public PredicateLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int mWidth = MeasureSpec.getSize(widthMeasureSpec);
int mCount = getChildCount();
int mX = 0;
int mY = 0;
mLeft = 0;
mRight = 0;
mTop = 5;
mBottom = 0;
int j = 0;
View lastview = null;
for (int i = 0; i < mCount; i++) {
final View child = getChildAt(i);
child.measure(MeasureSpec.UNSPECIFIED, MeasureSpec.UNSPECIFIED);
// 此处增加onlayout中的换行判断,用于计算所需的高度
int childw = child.getMeasuredWidth();
int childh = child.getMeasuredHeight();
mX += childw; //将每次子控件宽度进行统计叠加,如果大于设定的高度则需要换行,高度即Top坐标也需重新设置
Position position = new Position();
mLeft = getPosition(i - j, i);
mRight = mLeft + child.getMeasuredWidth();
if (mX >= mWidth) {
mX = childw;
mY += childh;
j = i;
mLeft = 0;
mRight = mLeft + child.getMeasuredWidth();
mTop = mY + 5;
//PS:如果发现高度还是有问题就得自己再细调了
}
mBottom = mTop + child.getMeasuredHeight();
mY = mTop; //每次的高度必须记录 否则控件会叠加到一起
position.left = mLeft;
position.top = mTop + 3;
position.right = mRight;
position.bottom = mBottom;
map.put(child, position);
}
setMeasuredDimension(mWidth, mBottom);
}
@Override
protected LayoutParams generateDefaultLayoutParams() {
return new LayoutParams(1, 1); // default of 1px spacing
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
// TODO Auto-generated method stub
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
Position pos = map.get(child);
if (pos != null) {
child.layout(pos.left, pos.top, pos.right, pos.bottom);
} else {
Log.i("MyLayout", "error");
}
}
}
private class Position {
int left, top, right, bottom;
}
public int getPosition(int IndexInRow, int childIndex) {
if (IndexInRow > 0) {
return getPosition(IndexInRow - 1, childIndex - 1)
+ getChildAt(childIndex - 1).getMeasuredWidth() + 8;
}
return getPaddingLeft();
}
}
3.将数据分别填充到左右两个控件中
这应该算是自动换行经典实例了吧,相信这个搞定以后同类型的需求都不成问题了。
‘柒’ 请问, android 代码中如何注释多行
eclipse中选中多行后,Ctrl+/
或
Ctrl+Shift+C
注释所选中的所有行。
studio中选中多行后,Ctrl+/
注释所选中的所有行。
而
Ctrl+Shift+/
则注释光标所选中的块
‘捌’ android怎么让一段长的代码自动换行
android开发使用的是eclipse或者android studio,内置的一个快捷键:ctrl+shift+F,可以自动变换格式,一些长得代码就会自动换行。
android开发工具会提供很多快捷键,比如alt+方向键实现移动代码等等。
‘玖’ 请问, android 代码中如何注释多行
eclipse中选中多行后,Ctrl+/ 或 Ctrl+Shift+C 注释所选中的所有行。
studio中选中多行后,Ctrl+/ 注释所选中的所有行。
而 Ctrl+Shift+/ 则注释光标所选中的块