Android布局-不显示图像视图
这是我的布局:
<?xml version="1.0" encoding="UTF-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<SurfaceView android:id="@+id/preview_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"/>
<ViewfinderView
android:id="@+id/viewfinder_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/transparent"/>
<LinearLayout
android:id="@+id/result_view"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/result_view"
android:visibility="gone"
android:padding="4dip">
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView android:id="@+id/App_logo"
android:src="@drawable/mylogo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView android:id="@+id/status_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/transparent"
android:text="@string/msg_default_status"
android:textColor="@color/status_text"
android:textSize="14sp"/>
</LinearLayout>
</FrameLayout>
问题是 XML
底部的 ImageView
没有显示。 有什么想法吗?
10X:)
This is my layout:
<?xml version="1.0" encoding="UTF-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<SurfaceView android:id="@+id/preview_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"/>
<ViewfinderView
android:id="@+id/viewfinder_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/transparent"/>
<LinearLayout
android:id="@+id/result_view"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/result_view"
android:visibility="gone"
android:padding="4dip">
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView android:id="@+id/App_logo"
android:src="@drawable/mylogo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView android:id="@+id/status_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/transparent"
android:text="@string/msg_default_status"
android:textColor="@color/status_text"
android:textSize="14sp"/>
</LinearLayout>
</FrameLayout>
The problem is that the ImageView
in the bottom of the XML
does not get displayed.
Any ideas?
10X :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
每个视图都包含其布局宽度和高度的“fill_parent”属性。您需要为它们指定“wrap_content”,或者将它们放置在具有正边距和负边距的容器中,否则它们都会尝试占用所有可用空间。
Each of your views contain the properties of "fill_parent" for their layout widths and heights. You need to either specify "wrap_content" for them, or place them in containers with positive and negative margins, or else they will all attempt to take up all of the available space.
您应该从图像视图中删除 android:layout_weight="1" ,图像就会出现。
You should remove android:layout_weight="1" from image view and image will appear.