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」

相關問題