Type One:XML布局文件编辑
1、TextView
编辑xml布局文件时可以引入
xmlns:tools="http://schemas.android.com/tools"
编辑文本时
tools:text=”只有在测试布局直观显示,正常运行项目不显示文本”
2、EditView之显示光标
1.在Edittext中加入以下属性
android:cursorVisible="true"
android:textCursorDrawable="@null"
2.在Edittext中加入以下属性
android:cursorVisible="true"
android:textCursorDrawable="@drawable/test_cursor"
对应的drawable文件
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 光标宽度可以自己定义 -->
<size android:width="1dp" />
<!-- 光标颜色可以自己定义 -->
<solid android:color="#008000" />
</shape>
3.如果以上没有效果就请用这个
明确指定EditText的inputType属性值inputType属性中的textCapSentences
不要用这个,国内手机好像没有用到这个,个人证实而已,用text或者textMultiLine
android:inputType="text|textMultiLine"
4.实现用一个TextView中间某一小段文字做成超链接,点击后能调用系统默认浏览器,跳转到指定网页这么一个功能
1)首先在strings.xml文件中直接写上TextView要显示的超链接文字,如下,超链接用html标签的写法来就行了
<string name="signup_agreeTerms">我同意<a href="http://www.baidu.com/">用户协议</a>中的所有内容</string>
2)然后你得在布局中拥有一个这样的TextView,注意,不要再添加什么autoLink、linksClickable属性之类的
<TextView
android:id="@+id/signup_txt_agreeTerms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/signup_agreeTerms"/>
3)在你的Activity中,添加如下代码
TextView textview = (TextView) findViewById(R.id.signup_txt_agreeTerms);
textview.setMovementMethod(LinkMovementMethod.getInstance()); //其实就这一句是关键
5、Android studio 在gradle文件中引入support:appcompat-v7:22.2.0包的时候,总是出现Failed to resolve的错误
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
6、动画资源说明
res / anim
放置视图动画有两种类型的动画,您可以使用视图动画框架:Tween动画:通过在动画框架动画的单个图像上执行一系列变换来创建动画:或通过显示来创建动画按照AnimationDrawable的顺序排列图像序列。
res / aminator
放置属性动画属性动画