在command line key這些指令之後
$ chmod +x ./gradlew
$ ./gradlew assembleDebug
再重新build即可
目前還不知道為何會發生這個事情...
public static class MyAdapter extends BaseAdapter {
private LayoutInflater inflater;
public MyAdapter(Context context) {
inflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return 10;
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return arg0;
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return 0;
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
View view = inflater.inflate(R.layout.listview_layout, null);
CheckBox check = (CheckBox) view.findViewById(R.id.check);
Drawable d= inflater.getContext().getResources()
.getDrawable(R.drawable.icon_item_small_selected);
if (arg0 == 1) {
d.setAlpha(255);
} else {
d.setAlpha(70);
}
check.setButtonDrawable(d);
return view;
}
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
View view = inflater.inflate(R.layout.listview_layout, null);
CheckBox check = (CheckBox) view.findViewById(R.id.check);
Drawable d = inflater.getContext().getResources()
.getDrawable(R.drawable.icon_item_small_selected);
if (arg0 == 1) {
d.mutate().setAlpha(255);
} else {
d.mutate().setAlpha(70);
}
check.setButtonDrawable(d);
return view;
}
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="#FFFFFF" />
</shape>
</item>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/ic_launcher" />
</item>
</layer-list>
<style name="myTheme" parent="Theme.AppCompat.Light">
<item name="android:windowBackground">@drawable/mylayer</item>
</style>
<activity
android:name="com.yesnews.sample.MainActivity"
android:label="@string/app_name"
android:theme="@style/myTheme"
>
......
如此就大功告成了!!