How To covered space of hide control in cardview layout?

meghatiwarimeghatiwari USMember ✭✭

hi!!! All

I am working on card view in which I fetch data from SQLite.
on card view there is some controls are hide and some are show according to condition.

I need help how to covered hide space on screen after deployed.

Along with card view I have use Relative layout for set control as per design.

and Still I'm not using any code or condition for this, Any body have any idea or any suggestion for this?

Answers

  • VIVEKNEGIVIVEKNEGI USMember ✭✭

    Set visibility to GONE

  • meghatiwarimeghatiwari USMember ✭✭

    @VIVEKNEGI

    I want to do this C# code in Xamarin android.
    and here is not about visibility , here is all about covered space of hide control.

  • VIVEKNEGIVIVEKNEGI USMember ✭✭

    @meghatiwari Could you just paste your code here.

  • meghatiwarimeghatiwari USMember ✭✭

    @VIVEKNEGI Sorry I don't write any code for this, I just create a Test App for this. You can also create one Test app with multiple controls there is some hide and some show. But those are shows controls they covered space of hide controls on layout.

  • VIVEKNEGIVIVEKNEGI USMember ✭✭

    If you set visibility of hide control as invisible then even on hide state they will take their space and show controls will never take their space. But if you set control visibility as invisible then they will leave their space and that space will be taken by show controls.

    eg. Let assume we have three button inside relative layout


    -- This button will be display on the screen

    --- This button will take space on the screen but could be be seen (HIDE)

    -- This button will be hide on the screen and it will release its space that will be taken by visible other component

    How you are hiding or showing the component . Just paste that code only

  • meghatiwarimeghatiwari USMember ✭✭

    @VIVEKNEGI This is my layout code now I want some controls are hide and covered space of hide controls.

                <RelativeLayout
                    android:orientation="horizontal"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:minWidth="25px"
                    android:minHeight="30px"
                    android:paddingBottom="4dp"
                    android:layout_marginBottom="0.0dp"
                    android:layout_marginRight="0.0dp">
                    <ImageView
                        android:id="@+id/ProfileImage"
                        android:src="@drawable/ic_user"
                        android:layout_width="54.5dp"
                        android:layout_height="54.5dp"
                        android:layout_alignParentLeft="true"
                        android:padding="5dp"
                        android:layout_marginBottom="0.0dp" />
                    <ImageView
                        android:id="@+id/Star"
                        android:src="@drawable/star"
                        android:layout_width="20.0dp"
                        android:layout_height="17.0dp"
                        android:layout_alignBottom="@id/ProfileImage"
                        android:layout_marginLeft="35.0dp"
                        android:layout_marginTop="0.0dp" />
                    <TextView
                        android:id="@+id/ServiceProviderRating"
                        android:layout_toEndOf="@id/Star"
                        android:textColor="#000000"
                        android:text=""
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="41.0dp" />
                    <TextView
                        android:id="@+id/CategoryName"
                        android:layout_below="@id/ProfileImage"
                        android:textColor="#000000"
                        android:text=""
                        android:textSize="12dp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingLeft="5dp"
                        android:layout_marginTop="1.0dp" />
                    <TextView
                        android:id="@+id/FirstName"
                        android:layout_toRightOf="@id/ProfileImage"
                        android:textColor="#000000"
                        android:text="First Name"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingLeft="5dp"
                        android:layout_marginLeft="25.0dp" />
                    <TextView
                        android:id="@+id/LastName"
                        android:layout_toRightOf="@id/FirstName"
                        android:textColor="#000000"
                        android:text="Last Name"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingLeft="5dp"
                        android:layout_marginLeft="3.5dp" />
                    <TextView
                        android:id="@+id/Date"
                        android:layout_below="@id/LastName"
                        android:layout_toRightOf="@id/ServiceProviderRating"
                        android:textColor="#000000"
                        android:text="01/07/2018"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingLeft="5dp"
                        android:layout_marginTop="7.0dp"
                        android:layout_marginLeft="25.0dp" />
                    <TextView
                        android:id="@+id/PhoneNumber"
                        android:layout_below="@id/Date"
                        android:layout_toRightOf="@id/ServiceProviderRating"
                        android:textColor="#000000"
                        android:text="+91 1234567890"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingLeft="5dp"
                        android:layout_marginTop="7.0dp"
                        android:layout_marginLeft="25.0dp" />
                    <ImageView
                        android:src="@drawable/home"
                        android:id="@+id/Home"
                        android:layout_below="@id/PhoneNumber"
                        android:textColor="@color/foreground_material_dark"
                        android:layout_height="16.5dp"
                        android:layout_width="27.0dp"
                        android:layout_marginTop="7.0dp"
                        android:layout_marginLeft="54.0dp" />
                    <TextView
                        android:id="@+id/Address"
                        android:layout_toRightOf="@id/Home"
                        android:layout_below="@id/PhoneNumber"
                        android:textColor="#000000"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:text="ADDRESS"
                        android:textSize="12dp"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingLeft="5dp"
                        android:layout_marginTop="7.0dp"
                        android:layout_marginLeft="0.0dp" />
                    <TextView
                        android:id="@+id/MinimumCharges"
                        android:layout_below="@id/Address"
                        android:textColor="#000000"
                        android:text="Minimum Charges"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:layout_width="120dp"
                        android:layout_height="wrap_content"
                        android:paddingLeft="2dp"
                        android:layout_marginTop="7.0dp" />
                    <TextView
                        android:id="@+id/By"
                        android:layout_below="@id/MinimumCharges"
                        android:textColor="#000000"
                        android:text="By"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingLeft="2dp"
                        android:layout_marginTop="7.0dp" />
                    <TextView
                        android:id="@+id/DisplayFName"
                        android:layout_below="@id/MinimumCharges"
                        android:layout_toRightOf="@id/By"
                        android:textColor="#000000"
                        android:text="FName"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingLeft="2dp"
                        android:layout_marginTop="7.0dp"
                        android:layout_marginLeft="112.0dp" />
                    <TextView
                        android:id="@+id/DisplayLName"
                        android:layout_below="@id/MinimumCharges"
                        android:layout_toRightOf="@id/DisplayFName"
                        android:textColor="#000000"
                        android:text="LName"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:paddingLeft="2dp"
                        android:layout_marginTop="7.0dp" />
                    <TextView
                        android:id="@+id/Charges"
                        android:layout_toRightOf="@id/MinimumCharges"
                        android:layout_below="@id/Address"
                        android:textColor="#000000"
                        android:text=""
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:layout_width="56.0dp"
                        android:layout_height="wrap_content"
                        android:paddingLeft="2dp"
                        android:layout_marginTop="10.0dp" />
                    <Button
                        android:id="@+id/btnDone"
                        android:layout_toRightOf="@id/Charges"
                        android:layout_below="@id/Address"
                        android:text="Done"
                        android:layout_width="69.0dp"
                        android:layout_height="28.5dp"
                        android:paddingLeft="5dp"
                        android:background="@drawable/buttonstyle"
                        android:textSize="8dp"
                        android:layout_marginLeft="0.0dp"
                        android:layout_marginTop="0.0dp" />
                    <Button
                        android:id="@+id/btnCancel"
                        android:layout_toRightOf="@id/btnDone"
                        android:layout_below="@id/Address"
                        android:text="Cancel"
                        android:layout_width="69.0dp"
                        android:layout_height="28.5dp"
                        android:paddingLeft="5dp"
                        android:background="@drawable/buttonstyle"
                        android:textSize="8dp"
                        android:layout_marginLeft="9.0dp"
                        android:layout_marginTop="0.5dp" />
                </RelativeLayout>
    
  • VIVEKNEGIVIVEKNEGI USMember ✭✭

    so just get id of all component by findviewbyid and set visibility of those component as Invisible, gone or Visible as you need. And I have already mentioned the difference between them.

Sign In or Register to comment.