1.TextureView的用途:承载显示流的View,用来做Camera和视频播放
2.使用Space控件其实就是为了适配控件,它比android:layout_margin之类的属性好用
3.TextViewCompat
AppCompatTextView最显著的特点是可以自适应字体宽度大小变化
例子:TextViewCompat.setAutoSizeTextTypeWithDefaults(tv_onepersonmorecard, TextViewCompat.AUTO_SIZE_TEXT_TYPE_NONE);
4.ImageView一个值得注意的属性adjustViewBounds
参考链接:https://www.jianshu.com/p/13de1774471c
在布局文件XML中设置adjustViewBounds="ture"的时候,会将这个ImageView的scaleType属性设置为fitCenter,当ImageView的layout_ width和layout_ height都是wrap_content的时候。adjustViewBounds是没有意义的。
5.获取系统语言
//得到Android系统上的语言列表
Locale mSystemLanguageList[]= Locale.getAvailableLocales()。
使用getLanguage()方法和getCountry方法,获取系统设置的语言和区域。
//获取系统当前使用的语言
String lan =Locale.getDefault().getLanguage();
//获取区域
String country =Locale.getDefault().getCountry();
//设置成简体中文的时候,getLanguage()返回的是zh,getCountry()返回的是cn.
//还有另外一种获取当前语言的方法:
Localelocale = getResources().getConfiguration().locale;
String language =locale.getLanguage(); // 获得语言码
6.LRecyclerView
支持addHeaderView、 addFooterView、下拉刷新、分页加载数据的RecyclerView。
它对 RecyclerView 控件进行了拓展,给RecyclerView增加HeaderView、FooterView,并且不需要对你的Adapter做任何修改。
使用:
Step 1. 在你的根build.gradle文件中增加JitPack仓库依赖。
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
Step 2. 在你的module的build.gradle文件中增加LRecyclerView依赖。
compile 'com.github.jdsjlzx:LRecyclerView:1.5.0'
LRecyclerView requires at minimum Java 7 or Android 4.0.
参考文章:LRecyclerView - qq_39767910的博客 - CSDN博客
7.新安装的Android studio出现错误
Could not find any version that matches com.android.support:appcompat-v7:25.+
Could not resolve all dependencies for configuration ':app:_debugApk'.
Error:Failed to resolve: com.android.support:appcompat-v7:25.+
appcompat-v7在SDK中下载不完整,可从其他电脑拷贝完整的v7包,
路径:StudioSDK\extras\android\m2repository\com\android\support\appcompat-v7
或者从sdk manger下载。