android背景图片旋转,在Android应用中以模糊效果设置背景图片

我试图使列表视图上的背景图像模糊,但是我尝试按照教程进行操作,但它不起作用.任何人都请指教,谢谢.

主要活动

public class IngredientCategoryMain extends Activity {

ListView list;

String[] title;

CategoryImageAdapter adapter;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_ingredient_category_main);

list=(ListView)findViewById(R.id.listView);

title = getResources().getStringArray(R.array.titles);

adapter=new CategoryImageAdapter(this, mStrings, title);

list.setAdapter(adapter);

}

@Override

public void onDestroy() {

list.setAdapter(null);

super.onDestroy();

}

public View.OnClickListener listener=new View.OnClickListener() {

@Override

public void onClick(View arg0) {

adapter.imageLoader.clearCache();

adapter.notifyDataSetChanged();

}

};

public void onItemClick(int mPosition) {

String tempValues = title[mPosition];

Toast.makeText(IngredientCategoryMain.this, "Click on image "+tempValues+" to enter", Toast.LENGTH_LONG).show();

}

private String[] mStrings={

"https://pixabay.com/static/uploads/photo/2014/07/08/14/33/breads-387544_960_720.jpg",

"http://mtbev.org/wp-content/uploads/2014/02/Bottles.jpg",

"https://c2.staticflickr.com/8/7023/6548962149_7a9fdd9cf4_b.jpg",

"https://upload.wikimedia.org/wikipedia/commons/2/2f/Culinary_fruits_front_view.jpg",

"https://upload.wikimedia.org/wikipedia/commons/e/ea/Indian_Spices.jpg",

"https://pixabay.com/static/uploads/photo/2016/01/13/17/21/raw-1138562_960_720.jpg",

"https://pixabay.com/static/uploads/photo/2010/12/13/09/51/seed-1716_960_720.jpg",

"https://upload.wikimedia.org/wikipedia/commons/b/ba/Rice_grains_(IRRI).jpg",

"http://www.stock-free.org/images/Thanksgiving-Stock-Free-Image-08112015-image-239.jpg",

"https://pixabay.com/static/uploads/photo/2012/10/01/18/34/dips-58738_960_720.jpg",

"https://pixabay.com/static/uploads/photo/2013/07/19/00/18/seafood-165220_960_720.jpg",

"https://c1.staticflickr.com/3/2877/10866943666_471d9f2845_b.jpg"

};

}

我设计了listview的xml文件

android:layout_width="fill_parent"

android:layout_height="wrap_content">

android:layout_width="90dp"

android:layout_height="90dp"

android:id="@+id/imageButton2"

android:scaleType="fitXY"

android:layout_below="@+id/textView2"

android:layout_alignParentStart="true"

android:layout_alignParentEnd="true" />

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:textAppearance="?android:attr/textAppearanceLarge"

android:id="@+id/textView2"

android:layout_marginLeft="20dp"

android:layout_alignParentTop="true"

android:layout_centerHorizontal="true"

android:textColor="#f7338b"

android:textStyle="bold"

android:background="#80ffffff" />

和listview.xml

xmlns:app="http://schemas.android.com/apk/res-auto"

xmlns:tools="http://schemas.android.com/tools"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:paddingBottom="@dimen/activity_vertical_margin"

android:paddingLeft="@dimen/activity_horizontal_margin"

android:paddingRight="@dimen/activity_horizontal_margin"

android:paddingTop="@dimen/activity_vertical_margin"

app:layout_behavior="@string/appbar_scrolling_view_behavior"

tools:context="com.example.cassieleong.delishcart.IngredientCategoryMain"

tools:showIn="@layout/activity_ingredient_category_main"

android:background="#fde7e7">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:id="@+id/listView"

android:layout_alignParentTop="true"

android:layout_alignParentStart="true"

android:background="@drawable/appicon"/>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值