EditText password = (EditText) findViewById(R.id.register_password_text);
password.setTypeface(Typeface.DEFAULT);
password.setTransformationMethod(new PasswordTransformationMethod());
参考:
http://stackoverflow.com/questions/3406534/password-hint-font-in-android
android:ellipsize="end"
android:maxLines="2"
原因:textview中包含了回车或者html字符
解决办法:
- myText.replaceAll("\\<.*?>","")
或者
- Html.fromHtml(myText).toString())
参考:
http://stackoverflow.com/questions/17131294/strange-issue-with-androidellipsize-end
在git提交的时候出现了这个错误,产生这个问题是因为在windows、Linux和Mac在处理文件换行时的标示符不一致。windows使用CRLF作为结束符,而Linux和Mac使用LF作为结束符。
如果刚从windows转到mac 开发,会遇到此错误,反之,则会出现warning: LF will be replaced by CRLF…..
解决办法:我们可以通过terminal.app 或者cmd 查看自己的git配置
$ git config core.autocrlf
如果显示true,则git会在提交的时候自动帮我们处理换行。可通过如下代码更改设置
$ git config --global core.autocrlf true
Error:(1, 0) Your project path contains non-ASCII characters. This will most likely
cause the build to fail on Windows. Please move your project to a different
directory. See http://b.android.com/95744 for details.
This warning can be disabled by using the command line flag
-Dcom.android.build.gradle.overridePathCheck=true, or adding the line
‘com.android.build.gradle.overridePathCheck=true’ to gradle.properties file
in the project directory.
导入或者新建androidstudio项目的时候,路径中包含了中文,去掉中文即可!!
解决方法:在setAdapter之前执行addHeaderView方法
public void addHeaderView(View v, Object data, boolean isSelectable) {
// 只要mAdapter不为空就抛出此异常
if (mAdapter != null && ! (mAdapter instanceof HeaderViewListAdapter)) {
throw new IllegalStateException(
"Cannot add header view to list -- setAdapter has already been called.");
}
//......
}
这个问题是Android系统本身的bug,没有很好的解决办法,有说是全角半角的问题,有说用JustifyTextView可以解决问题,也有通过自定义控件解决问题的.比如如下这种情况
最终TextView中英文排版混乱 这篇博文在一定程度上解决了我的问题,感谢.遇到同样问题的可以看看
主要思路是通过一个list将所有的字符存起来,再canvas.drawtext来解决问题.
抛出这个异常的原因是试图在activity的状态已经保存之后提交FragmentTransaction,导致activity状态丢失.
解决建议:
onCreate()
中或者FragmentActivity#onResumeFragments()
或者Activity#onPostResume()
中commit
AsyncTask#onPostExecute()
commitAllowingStateLoss()
来提交详细介绍:Fragment Transactions & Activity State Loss