Проблема макета в Android Studio, но не в Eclipse? - PullRequest
0 голосов
/ 20 сентября 2018

Я только что перешел из Eclipse в Android Studio, и у меня возникла проблема со следующим макетом XML.Обратите внимание, что в Eclipse он безупречен.

<LinearLayout
android:id="@+id/tabview"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="2" >
<TableLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"> 
   <TableRow
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:weightSum="1"
        android:layout_weight="0.5">
        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:clickable="true" >
            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/btnKnowledge"
                android:background="@drawable/right_buttom_btn_line"
                android:text="@string/learn"
                android:textAllCaps="false"
                android:textSize="18sp"
                android:gravity="center|bottom"
                android:singleLine="false"
                android:paddingBottom="10dp"/>
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/h_know"
                android:layout_centerInParent="true"/>
        </RelativeLayout>
        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="0.5">
            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:id="@+id/btnDictionaryManager"
                android:background="@drawable/right_buttom_btn_line"
                android:text="@string/csdl_"
                android:textSize="18sp"
                android:textAllCaps="false"
                android:gravity="center|bottom"
                android:singleLine="false"
                android:paddingBottom="10dp"/>
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/dic_db2" 
                android:layout_centerInParent="true"/>
        </RelativeLayout>
    </TableRow>
</TableLayout>
</LinearLayout> 

Этот макет правильно отображается в Eclipse, как и ожидалось, но в Android Studio изображения в середине отсутствуют.enter image description here enter image description here

В чем проблема?Как это можно решить? Помощь оценена.

1 Ответ

0 голосов
/ 20 сентября 2018

Ваш ImageViews, вероятно, скрыт кнопками.Добавьте небольшую отметку к вашему ImageViews - что-то вроде 2dp.Вероятно, вы видите разницу в уровнях API между вашей установкой Eclipse и Android Studio (предположение.)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...