【发布时间】:2011-12-16 12:23:51
【问题描述】:
我有一个用 xml 制作的 android 应用程序布局。最后一个文本视图没有显示。为什么?我能做些什么?我尝试使用高度设置线性布局:fill_parent、wrap_content 和 match_parent: 这是布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@drawable/sfondo">
<LinearLayout android:id="@+id/linearLayout2"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:orientation="vertical">
<LinearLayout android:id="@+id/linearLayout1"
android:layout_height="fill_parent" android:weightSum="1"
android:layout_width="fill_parent" android:orientation="horizontal">
<ImageButton android:id="@+id/back1" android:src="@drawable/back"
android:background="@null" android:layout_marginTop="25dip"
android:layout_width="wrap_content" android:layout_height="wrap_content">
</ImageButton>
<ImageView android:layout_height="wrap_content" android:id="@+id/logoTC"
android:src="@drawable/trovachiavi_contatti" android:layout_width="wrap_content"
android:layout_marginTop="20dp">
</ImageView>
<ImageButton android:id="@+id/infoButton"
android:background="@null" android:layout_height="wrap_content"
android:layout_marginTop="10dip" android:src="@drawable/info_mini"
android:layout_width="wrap_content"></ImageButton>
</LinearLayout>
</LinearLayout>
<LinearLayout android:layout_width="match_parent"
android:layout_height="fill_parent" android:id="@+id/layoutGif1"
android:orientation="vertical">
<spazio.digitale.com.GIFView
android:layout_gravity="center" android:layout_width="wrap_content"
android:layout_height="220dp" android:id="@+id/GIFMulti"
android:layout_marginLeft="40dp"></spazio.digitale.com.GIFView>
<TextView android:layout_height="wrap_content" android:id="@+id/testoAiuto"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content" android:gravity="center"
android:textColor="@android:color/black" android:layout_marginTop="-210dp"></TextView>
<ImageButton android:layout_gravity="center|bottom"
android:layout_width="wrap_content" android:layout_marginTop="25dp"
android:layout_height="wrap_content" android:background="@null"
android:id="@+id/avvia_cerca"></ImageButton>
<TextView android:layout_width="match_parent" android:id="@+id/testoRicercaMulti"
android:layout_height="wrap_content" android:textColor="@android:color/black"
android:textSize="14dp" android:gravity="center"
android:layout_gravity="center" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
</TextView>
</LinearLayout>
【问题讨论】:
-
发布您在屏幕上看到的屏幕截图?哦,fill_parent 是 match_parent 的弃用版本,顺便说一句,它们做的完全一样。
-
模拟器很差!我在 Galaxy S II 上试了试,在屏幕的尽头有一个矩形部分隐藏了我的 textview..
-
嗯,所以你的视图填满了整个屏幕,然后一些?您是否尝试过将整个内容放在 ScrollView 中?
标签: android xml layout textview imagebutton