我是 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%,我还没有设法更改它)
最佳答案
在类Coverflow中的setAdapter方法中可以看到,适配器的宽度和高度设置为imageWidth/imageHeight,因此在parseAttributes方法中修改这两个变量的值。
编辑:我想你可以修改 AbstractCoverflowAdapter 以膨胀一个 xml,其中包含宽度/高度设置为 fill_parent 的 ImageView。这应该有效: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);
关于java - android 覆盖流高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11096867/