【发布时间】:2019-02-25 00:24:31
【问题描述】:
我刚刚从 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 中,中间的图像丢失。
有什么问题?如何解决? 帮助表示赞赏。
【问题讨论】:
-
尝试干净的构建并运行,然后看不到尝试无效并重新启动。在我的工作室中,这个布局文件可以正常工作。
标签: eclipse android-layout android-studio