Imageview и textview не отображаются в поле зрения?

Я пытаюсь надуть макет и добавить его в перетаскиваемый вид сетки, но все, что я получаю, - это желтый квадрат. Метод addView () перетаскиваемого представления выбирает только один вид. Например, если я добавлю textView или imageView, то текстовое представление будет отображаться. Если я добавлю линейную разметку, то будет отображаться только фон (линейное разложение) линейного разметки. Но это не линейные объекты childs (изображение и текстовое представление). DGV (перетаскиваемый Gridview) расширяет ViewGroup Вот код:

добавление линейного макета:

LayoutInflater inflater = LayoutInflater.from (getActivity ());
View cellView = inflater.inflate (R.layout.celllayout, null);
if (cellView != null)
Log.d ("Snap", "cellView != null");
TextView textView = (TextView) cellView.findViewById (R.id.grid_label);
textView.setText (word);
ImageView imageView =  (ImageView) cellView.findViewById (R.id.grid_image);
imageView.setImageBitmap (getThumb (word));

dgv.addView (cellView);

Линейный макет:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF000"
android:gravity="center"
android:orientation="vertical"
android:padding="5dp" >

<TextView
android:id="@+id/grid_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dip"
android:text="@string/grid_label"
android:textColor="#c31d36"
android:textSize="15sp" />
<ImageView
android:id="@+id/grid_image"
android:layout_width="150dip"
android:layout_height="150dip"
android:layout_gravity="center_horizontal"
android:contentDescription="An Image" 
android:background="#ffff0000"/>

</LinearLayout>

DGV:

@Override
public void addView (View child) {
    super.addView (child);
    Log.d ("Draggable", "Draggable-addView");

    newPositions.add (-1);
}

Есть идеи? Нужно ли предоставлять больше информации? Мое единственное решение - настроить просмотр изображений, переопределить ondraw и делать то, что я хочу. Но это так нахально и не масштабируемо. Любая помощь будет оценена.

Ответы на вопрос(1)

Ваш ответ на вопрос