0

我正在使用带有一些EditText控件和QuickContactBadge的FrameLayout。它很好,直到这里。当我运行该应用程序时,我能够看到所有控件,但QuickContactBadge未出现在布局中。QuickcontactBadge在运行应用程序时未在布局中显示

我需要做些什么才能看到它?我错过了什么吗?

这是我的布局文件,

<?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" > 

<ImageView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:scaleType="fitXY" 
    android:src="@drawable/pattern1" /> 

<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginBottom="50dp" 
    android:orientation="vertical" > 

    <ScrollView 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" > 

     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" > 

      <RelativeLayout 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" > 

       <QuickContactBadge 
        android:id="@+id/quickContactBadge1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_alignParentBottom="true" 
        android:layout_alignParentRight="true" 
        android:layout_alignParentTop="true" 
        android:layout_marginRight="10dp" 
        android:scaleType="centerCrop" /> 

       <EditText 
        android:id="@+id/txtlastname" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_alignParentBottom="true" 
        android:layout_alignParentLeft="true" 
        android:layout_alignRight="@+id/edttxtfirstname" 
        android:layout_marginTop="50dp" 
        android:ems="10" 
        android:hint="Last Name" 
        android:inputType="textPersonName" 
        android:textColor="#000000" /> 

       <EditText 
        android:id="@+id/edttxtfirstname" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_alignParentLeft="true" 
        android:layout_alignParentTop="true" 
        android:ems="10" 
        android:hint="First Name" 
        android:inputType="textPersonName" 
        android:textColor="#000000" > 

        <requestFocus /> 
       </EditText> 
      </RelativeLayout> 

      <View 
       android:layout_width="match_parent" 
       android:layout_height="2dp" 
       android:background="#000000" > 
      </View> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="horizontal" > 

       <TextView 
        android:id="@+id/txtheadingphone" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:layout_alignParentBottom="true" 
        android:layout_alignRight="@+id/editText2" 
        android:layout_gravity="center" 
        android:layout_marginRight="70dp" 
        android:layout_weight="0.63" 
        android:gravity="center_vertical" 
        android:text="Phone" 
        android:textColor="#ffffffff" /> 

       <ImageButton 
        android:id="@+id/imgbtnaddphone" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@android:drawable/ic_input_add" /> 
      </LinearLayout> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="horizontal" > 

       <Button 
        android:id="@+id/btnchphone" 
        style="?android:attr/buttonStyleSmall" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Phone" 
        android:textColor="#ffffffff" /> 

       <EditText 
        android:id="@+id/edttxtphone" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_weight="0.48" 
        android:ems="10" 
        android:gravity="center" 
        android:hint="Phone Number" 
        android:inputType="phone" 
        android:textColor="#000000" /> 

       <ImageButton 
        android:id="@+id/imgbtndelphone" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@android:drawable/ic_input_delete" /> 
      </LinearLayout> 

      <View 
       android:layout_width="match_parent" 
       android:layout_height="2dp" 
       android:background="#000000" > 
      </View> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="horizontal" > 

       <TextView 
        android:id="@+id/txtheadingaddress" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:layout_alignParentBottom="true" 
        android:layout_alignRight="@+id/editText2" 
        android:layout_gravity="center" 
        android:layout_marginRight="70dp" 
        android:layout_weight="0.63" 
        android:gravity="center_vertical" 
        android:text="Address" 
        android:textColor="#ffffffff" /> 

       <ImageButton 
        android:id="@+id/imgbtnaddAddress" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@android:drawable/ic_input_add" /> 
      </LinearLayout> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="vertical" > 
      </LinearLayout> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="horizontal" > 

       <Button 
        android:id="@+id/btnAddress" 
        style="?android:attr/buttonStyleSmall" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Home" 
        android:textColor="#ffffffff" /> 

       <EditText 
        android:id="@+id/edttxtaddress" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:ems="10" 
        android:gravity="center" 
        android:hint="Address" 
        android:inputType="textPostalAddress" 
        android:textColor="#000000" /> 

       <ImageButton 
        android:id="@+id/imgbtndeladdress" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@android:drawable/ic_input_delete" /> 
      </LinearLayout> 

      <EditText 
       android:id="@+id/edttxtcity" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:ems="10" 
       android:gravity="center" 
       android:hint="City" 
       android:textColor="#000000" /> 

      <EditText 
       android:id="@+id/edttxtstate" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:ems="10" 
       android:gravity="center" 
       android:hint="State" 
       android:textColor="#000000" /> 

      <EditText 
       android:id="@+id/edttxzipcode" 
       android:layout_width="236dp" 
       android:layout_height="wrap_content" 
       android:ems="10" 
       android:gravity="center" 
       android:hint="ZipCode" 
       android:inputType="phone" 
       android:textColor="#000000" /> 

      <View 
       android:layout_width="match_parent" 
       android:layout_height="2dp" 
       android:background="#000000" > 
      </View> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="horizontal" > 

       <TextView 
        android:id="@+id/txtemail" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:layout_gravity="center" 
        android:layout_marginRight="70dp" 
        android:layout_weight="0.63" 
        android:gravity="center_vertical" 
        android:text="Email" 
        android:textColor="#ffffffff" /> 

       <ImageButton 
        android:id="@+id/imgbtnaddemail" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@android:drawable/ic_input_add" /> 
      </LinearLayout> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:orientation="horizontal" > 

       <Button 
        android:id="@+id/btnchemail" 
        style="?android:attr/buttonStyleSmall" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Email" 
        android:textColor="#ffffffff" /> 

       <EditText 
        android:id="@+id/edttxtemail" 
        android:layout_width="128dp" 
        android:layout_height="wrap_content" 
        android:layout_weight="0.48" 
        android:ems="10" 
        android:gravity="center" 
        android:hint="" 
        android:inputType="textEmailAddress" 
        android:textColor="#000000" /> 

       <ImageButton 
        android:id="@+id/imgbtndelemail" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:src="@android:drawable/ic_input_delete" /> 
      </LinearLayout> 
     </LinearLayout> 
    </ScrollView> 
</LinearLayout> 

<LinearLayout 
    android:id="@+id/LinearLayout02" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_gravity="bottom" 
    android:background="#AA000000" > 

    <Button 
     android:id="@+id/btnsave" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:onClick="addCustomerDetails" 
     android:text="Save" 
     android:textColor="#000000" 
     > 
    </Button> 

    <Button 
     android:id="@+id/btncancel" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:text="Cancel" 
     android:textColor="#000000" 
     android:onClick="canceladdcustomer"> 
    </Button> 
</LinearLayout> 

</FrameLayout> 

请指正或提供任何有用的链接,这样我会知道我的错误。

感谢您的宝贵帮助!

+0

在framelayout中,视图彼此堆叠在一起,顶部的视图可见。在你的布局中,父容器是一个FrameLayout,并且在那里你首先添加了一个图像视图,然后再添加一个线性布局,然后再一个线性布局,等等......它们相互堆叠在一起。尝试使用LinearLayout或RelativeLayout等其他容器。 – karn

+0

@karn,我需要保存和取消按钮重叠LinearLayout。所以我选择了使用Framelayout! – Mahe

+0

您可以上传显示布局设计的图形表示(粗略图)。这样就可以更容易地知道你想要达到的目标。 – karn

回答

0

添加标签android:visibility =“visible”

相关问题