У меня проблема с моим GridView. Я использую часть проекта Bitmapfun, и я не хочу иметь преимущество сверху.Margin/padding top on GridView
Смотрите этот захват:
У меня есть большая черная область (где я поставил 3 вопросительных знаков) между блесной и первыми фотографиями.
Если я прокручиваю вниз, я получаю хороший рендеринг: фото слайда под блесной:
Если я вернусь к началу, я снова это большая черную область только перед первой фотографией. Кто-нибудь может мне помочь?
Вот мой GridView (image_grid_fragment.xml):
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridView"
style="@style/PhotoGridLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="@dimen/image_thumbnail_size"
android:horizontalSpacing="@dimen/image_thumbnail_spacing"
android:numColumns="auto_fit"
android:stretchMode="columnWidth"
android:verticalSpacing="@dimen/image_thumbnail_spacing" >
</GridView>
В GridView входит в этот основной раскладке:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/TextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="17dp"
android:layout_marginLeft="16dp"
android:text="Album : "
android:textAppearance="?android:attr/textAppearanceSmallPopupMenu"
android:textSize="18dp" />
<Spinner
android:id="@+id/spinner_album"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/TextView1"
android:layout_marginTop="12dp"
android:inputType="text"
android:textSize="18dp" />
<include layout="@layout/image_grid_fragment" />
</RelativeLayout>
значения/styles.xml:
<style name="PhotoGridLayout">
<item name="android:drawSelectorOnTop">false</item>
<item name="android:listSelector">@drawable/photogrid_list_selector</item>
</style>
значения-v11/styles.xml:
<style name="PhotoGridLayout">
<item name="android:drawSelectorOnTop">true</item>
</style>
ImageGridActivity.java:
public class ImageGridActivity extends FragmentActivity {
private static final String TAG = "ImageGridFragment";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getSupportFragmentManager().findFragmentByTag(TAG) == null) {
final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(android.R.id.content, new ImageGridFragment(), TAG);
ft.commit();
}
}
}
С компоновочных границ активированными в вариантах развития, у меня есть этот результат:
Можете ли вы разместить xml для 'style/PhotoGridLayout', а также –
Tim> конечно, я отредактировал мое сообщение. Благодаря ! – Jerry
Ничего странного там. Проблема может быть в том, что выглядит как Spinner, над фактическим GridView. У вас есть код/xml для этого? –