Textview 中 跑马灯特效展示的几个必备条件
android:singleLine=“true”
android:ellipsize=“marquee”
android:maxEms=“4”
android:marqueeRepeatLimit="-1"
最后一个要在代码中设置:
mTextView.setSelected(true);
TextView 中一种很好看的字体
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:fontFamily=“sans-serif-medium”
android:text=“哈哈哈哈哈”
sans-serif-medium
android studio 引入有地址的包
以引入 butterknife为例:
首先在app的buildgradle里面加这句话:后面的是下载地址。
然后点击android studio中的一个按钮:
然后关于网络下载的引用包,就会出现在 project 文件查看模式下,的external libraries 文件夹下就会出现新下载好的这个包:
然后 rebuld project 就能用了!
ScrollView中嵌套的唯一子view,不能铺满scroll view的问题
为 scroll view 添加一个属性:android:fillViewport=“true”。即可
当ScrollView里的元素想填满ScrollView时,使用"fill_parent"或者"match_parent"是不管用的,必需为ScrollView设置:android:fillViewport=“true”。
参考文章
当ScrollView没有fillVeewport=“true”时, 里面的元素(比如LinearLayout)会按照wrap_content来计算(不论它是否设了"fill_parent"或者"match_parent"),而如果LinearLayout的元素设置了fill_parent,那么也是不管用的,因为LinearLayout依赖里面的元素,而里面的元素又依赖LinearLayout,这样自相矛盾.所以里面元素设置了fill_parent,也会当做wrap_content来计算.