安卓tips
安卓期末大作业做好了,总结一下
分割线
网上有许多方法,我选择了一种适合我的方法,新建一个布局xx.xml,需要时在别的布局中使用include引用
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#11999999">
</ImageView>
设置图片
图片设置按钮
<ImageButton
android:id="@+id/main_bt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
android:scaleType="fitCenter"
android:src="@drawable/j77" />
RatingBar的使用
这个我也是第一次遇见,用的时候发现有点大,需要使用style这行代码,可以自适应使用
<RatingBar
android:id="@+id/pj1"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:isScrollContainer="true"
android:progressTint="#ffd700" />
设置字体下划线
forget.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
动态设置图片资源
xx.setImageResource(R.drawable.ic_22_hide);