我是Android开发的新手。
我目前正在测试在这里找到的android coverflow:http://code.google.com/p/android-coverflow/
我在我的项目中成功地实现了它,但是我找不到一种方法来给小部件提供所需的宽度和高度
我的布局:
<view
xmlns:coverflow="http://schemas.android.com/apk/res/com.accessdev.myapp"
android:id="@+id/coverflow"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="5dip"
class="pl.polidea.coverflow.CoverFlow"
coverflow:imageHeight="150dip"
coverflow:imageWidth="100dip" >
</view>更改coverflow:imageHeight和coverflow:imageWidth仅影响图像的大小,但小部件不会填充布局的高度(它大约占屏幕的10%,我还没有设法更改它)
发布于 2012-06-19 17:10:45
正如您在方法setAdapter中的Coverflow类中看到的,适配器的宽度和高度被设置为imageWidth/imageHeight,因此在parseAttributes方法中修改这两个变量的值。
编辑:我认为您可以修改AbstractCoverflowAdapter来膨胀包含宽度/高度设置为fill_parent的ImageView的xml。这应该是可行的:D
对于XML:
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/image"
android:layout_width="200dip"
android:layout_height="400dip"
android:src="@drawable/ic_launcher" />在适配器的getView()中:
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.your_layout, parent, false);
ImageView image = (ImageView) row.findViewById(R.id.image);
image.setImageBitmap(your_bitmap);https://stackoverflow.com/questions/11096867
复制相似问题