0

Android 開発は初めてです

私は現在、ここにあるアンドロイドカバーフローをテストしています: 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% のようで、まだ変更できませんでした)。

4

1 に答える 1

1

メソッド setAdapter のクラス Coverflow でわかるように、アダプターの幅と高さは imageWidth/imageHeight に設定されているため、parseAttributes メソッドで 2 つの変数の値を変更します。

編集: 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);
于 2012-06-19T09:10:44.683 に答える