2012-08-24 50 views
0

我想如下放置在.xml文件的布局图像视图下一个按钮:按键布局没有显示

<?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:orientation="vertical" > 

<TextView 
    android:id="@+id/name" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Name: " /> 

<LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal"> 
      <TextView 
       android:id="@+id/divider01" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Meeting Point Position" 
       android:paddingLeft="100dp" 
       android:textColor="@android:color/black" 
       android:textSize="9dp" 
       android:background="@drawable/t_505_12"> 
      </TextView> 
</LinearLayout> 

<TextView 
    android:id="@+id/lat" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="LAT: " /> 

<TextView 
    android:id="@+id/lng" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="LNG: " /> 

<LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal"> 
      <TextView 
       android:id="@+id/divider01" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Date/Time" 
       android:paddingLeft="120dp" 
       android:textColor="@android:color/black" 
       android:textSize="9dp" 
       android:background="@drawable/t_505_12"> 
      </TextView> 
</LinearLayout> 

<TextView 
    android:id="@+id/date" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Date: " /> 

<TextView 
    android:id="@+id/time" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Time: " /> 

<LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal"> 
      <TextView 
       android:id="@+id/divider01" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Navigation Arrow" 
       android:paddingLeft="120dp" 
       android:textColor="@android:color/black" 
       android:textSize="9dp" 
       android:background="@drawable/t_505_12"> 
      </TextView> 
</LinearLayout> 

<LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 

    <ImageView 
    android:id="@+id/iv01" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"/> 

<Button 
    android:id="@+id/bt01" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="90sp" 
    android:layout_marginTop="190sp"  
    android:text="Navigate" /> 
    </LinearLayout> 

但问题是:只有图像视图出现,并且按钮不显示。 关于如何解决这个问题的任何建议?

+0

您正在使用3个LinearLayouts!这不仅仅是理由。只使用一个LinearLayout并在其中分布视图。 – PacQ

回答

0

只是尽量把你的代码放到ScrollView

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/scrollView1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" > 

    <!-- 
      Here Goes your whole Layoout 
     --> 

    </ScrollView> 

好运。

0

它们是否包含在LinearLayout中?

您可以随时设置按钮的顶部绘制的机器人通过:drawableTop属性

+0

是垂直布局 – LetsamrIt

+0

垂直布局不是整体布局类型。这是一个子标签。 –

+0

如果图片太大,而且屏幕很小,那么按钮可以隐藏。按钮内有很大的余量。你能粘贴你的整个XML文件吗? – tasomaniac

0

你的ImageView可能会迫使你的按钮,屏幕关闭。你的形象有多大?您可以尝试缩小图像大小并将其放回到ImageView中以查看您的按钮是否出现?我假设你正在使用类似于LinearLayout的东西。如果你使用的是相对布局,那么我认为你应该放置一个layout_below标签或类似的东西。此外,您可以尝试将Button放置在ImageView上方的xml文件中,以便图像在您的按钮下方,如果您的按钮没有显示出来,那么必须有一个替代问题。

+0

按照设计,按钮应该低于 – LetsamrIt

+0

请告诉我如何设置图像的大小 – LetsamrIt