2016-10-24 1 views
0

selon l'image lorsque je remplace mon fragment dans FrameLayout la taille n'est pas en forme. par exemple mon bouton en page est sous l'objet principal de mise en page enter image description here code mise en page de activity_mainfragment android remplacer fiil_parent avec mise en page

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/activity_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/colorPrimary" 
    android:orientation="vertical" 
    tools:context="com.teskaco.bbpos.Activities.MainActivities.MainActivity"> 

    <com.alirezaafkar.toolbar.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/colorPrimary" 
     android:paddingTop="@dimen/app_bar_top_padding" 
     app:direction="rtl" 
     app:font="@string/font_path" 
     app:navigationIcon="@drawable/m_e_n_u" 
     app:optionsMenu="@menu/main_menu"> 

     <com.teskaco.bbpos.CustumView.CustomTextView 
      android:id="@+id/main_title" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:gravity="center" 
      android:text="@string/psp_name" 
      android:textColor="@color/colorControlNormal" 
      android:textSize="@dimen/small_text_size" /> 
    </com.alirezaafkar.toolbar.Toolbar> 


    <FrameLayout 
     android:id="@+id/main_fragment" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" /> 

    <include 
     android:id="@+id/buttonPanel" 
     layout="@layout/main_top_bar" /> 


</LinearLayout> 

ma mise en page de fragment code xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:id="@+id/fragment_pay" 
    tools:context="com.teskaco.bbpos.Activities.MainActivities.PayBillFragment"> 
    <com.teskaco.bbpos.CustumView.CustomButton 
     android:id="@+id/send_button" 
     style="@style/LightRaiseColorButtonRippleStyle" 
     android:layout_width="@dimen/_300sdp" 
     android:layout_height="@dimen/button_height" 
     android:layout_gravity="center" 
     android:layout_marginTop="@dimen/_4sdp" 
     android:gravity="center" 
     android:text="@string/send_button" 
     android:textColor="@color/disable_button" 
     android:textSize="@dimen/button_text_size" /> 

    <LinearLayout 
     android:orientation="vertical" 
     android:gravity="center|top" 
     android:layout_width="match_parent" 
     android:layout_weight="1" 
     android:layout_height="match_parent" 
     android:layout_marginTop="@dimen/_6sdp" 
     android:background="@color/white"> 

     <RelativeLayout 
      android:id="@+id/skech_layout" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="@dimen/_4sdp" 
      android:background="@color/white"> 

      <ImageView 
       android:id="@+id/skech_image" 
       android:layout_width="@dimen/_90sdp" 
       android:layout_height="@dimen/_101sdp" 
       android:layout_centerHorizontal="true" 
       android:src="@drawable/ghabz" /> 

      <com.teskaco.bbpos.CustumView.CustomTextView 
       android:id="@+id/ghabz_textview" 
       android:layout_width="@dimen/_250sdp" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/skech_image" 
       android:layout_centerHorizontal="true" 
       android:layout_marginTop="@dimen/_21sdp" 
       android:gravity="center" 
       android:text="@string/bill_text" 
       android:textSize="@dimen/mediume_text_size" /> 
     </RelativeLayout> 

     <LinearLayout 
      android:id="@+id/name_layout" 
      android:layout_width="@dimen/_250sdp" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="@dimen/_8sdp" 
      android:background="@drawable/raduis_bg_edit_text" 
      android:orientation="horizontal"> 


      <com.teskaco.bbpos.CustumView.CustomTextInputLayout 
       android:id="@+id/shenase_text_input_layout" 
       android:layout_width="@dimen/_210sdp" 
       android:layout_height="wrap_content" 
       android:layout_margin="@dimen/_5sdp" 
       android:theme="@style/TextLabel"> 

       <com.teskaco.bbpos.CustumView.CustomEditText 
        android:id="@+id/id_bill" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="@dimen/_6sdp" 
        android:layout_marginRight="@dimen/_6sdp" 
        android:layout_marginTop="@dimen/_4sdp" 
        android:background="@null" 
        android:gravity="right" 
        android:hint="@string/id_Bill_text" 
        android:inputType="number" 
        android:paddingBottom="@dimen/_4sdp" 
        android:textColor="@color/green_blue" 
        android:textSize="@dimen/defult_text_size" /> 
      </com.teskaco.bbpos.CustumView.CustomTextInputLayout> 

      <android.support.v7.widget.AppCompatImageView 
       android:layout_width="@dimen/_16sdp" 
       android:layout_height="@dimen/_12sdp" 
       android:layout_gravity="center" 
       android:layout_marginLeft="@dimen/_5sdp" 
       android:background="@drawable/user_id" /> 

     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/name_layout1" 
      android:layout_width="@dimen/_250sdp" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="@dimen/_8sdp" 
      android:background="@drawable/raduis_bg_edit_text" 
      android:orientation="horizontal"> 


      <com.teskaco.bbpos.CustumView.CustomTextInputLayout 
       android:id="@+id/payment_text_input_layout" 
       android:layout_width="@dimen/_210sdp" 
       android:layout_height="wrap_content" 
       android:layout_margin="@dimen/_5sdp" 
       android:theme="@style/TextLabel"> 

       <com.teskaco.bbpos.CustumView.CustomEditText 
        android:id="@+id/id_payment" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_marginLeft="@dimen/_6sdp" 
        android:layout_marginRight="@dimen/_6sdp" 
        android:layout_marginTop="@dimen/_4sdp" 
        android:background="@null" 
        android:gravity="right" 
        android:hint="@string/id_payment_text" 
        android:inputType="number" 
        android:paddingBottom="@dimen/_4sdp" 
        android:textColor="@color/green_blue" 
        android:textSize="@dimen/defult_text_size" /> 
      </com.teskaco.bbpos.CustumView.CustomTextInputLayout> 

      <android.support.v7.widget.AppCompatImageView 
       android:layout_width="@dimen/_16sdp" 
       android:layout_height="@dimen/_12sdp" 
       android:layout_gravity="center" 
       android:layout_marginLeft="@dimen/_5sdp" 
       android:background="@drawable/user_id" /> 

     </LinearLayout> 


     <com.teskaco.bbpos.CustumView.CustomButton 
      android:id="@+id/barcode_reader" 
      style="@style/GrayRaiseColorButtonRippleStyle" 
      android:layout_width="@dimen/_250sdp" 
      android:layout_height="@dimen/button_height" 

      android:layout_gravity="center" 
      android:layout_marginTop="@dimen/_24sdp" 
      android:gravity="center" 
      android:text="@string/barcode_reader_text" 
      android:textColor="@color/disable_button" 
      android:textSize="@dimen/button_text_size" /> 

    </LinearLayout> 

</LinearLayout> 

remplacer le code

fragmentManager = getSupportFragmentManager(); 
fragmentManager.beginTransaction().replace(R.id.main_fragment, PayBillFragment.newInstance()).addToBackStack("PayBill").commit(); 
+0

fill_parent est dépréciée, fill_parent et match_parent sont exactement les mêmes – MichaelStoddart

+0

@MichaelStoddart ouais. droite. mais j'utilise math_parent et j'ai encore ce problème –

Répondre

0

Vous devez utiliser Parent Layout en tant que RelativeLayout et utilisez la propriété RelativeLayout.

<com.alirezaafkar.toolbar.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/colorPrimary" 
     android:paddingTop="@dimen/app_bar_top_padding" 
     app:direction="rtl" 
     app:font="@string/font_path" 
     app:navigationIcon="@drawable/m_e_n_u" 
     app:optionsMenu="@menu/main_menu"> 

     <com.teskaco.bbpos.CustumView.CustomTextView 
      android:id="@+id/main_title" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:gravity="center" 
      android:text="@string/psp_name" 
      android:textColor="@color/colorControlNormal" 
      android:textSize="@dimen/small_text_size" /> 
    </com.alirezaafkar.toolbar.Toolbar> 


    <FrameLayout 
     android:id="@+id/main_fragment" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@+id/buttonPanel" /> 


    <include 
     android:id="@+id/buttonPanel" 
     layout="@layout/tab_bottom_menus" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" /> 
</RelativeLayout> 
+0

je fais ceci. mais encore une fois j'ai ce problème –

+0

si vous partagez votre code, je vais vérifier. –