Android - Setting both TileMode and Gravity

眉间皱痕 提交于 2020-01-04 02:29:47

问题


I have a ListView in an XML-layout. I want to set a new background to this view by using the following code:

BitmapDrawable TileMe = new BitmapDrawable(BitmapFactory.decodeResource(getResources(), R.drawable.bg_skyline));
TileMe.setGravity(Gravity.BOTTOM); // Bottom
TileMe.setTileModeX(Shader.TileMode.REPEAT);
ListView test = getListView();
test.setBackgroundDrawable(TileMe);

The problem is that if I leave both the Gravity and the TileMode lines uncommented, only TileMode will work. If i comment the TileMode line, the Gravity line will work.

Am I doing something wrong or is Android messing with my head?


回答1:


Gravity is ignored when the tile mode is enabled. Link



来源:https://stackoverflow.com/questions/8401143/android-setting-both-tilemode-and-gravity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!