Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7870385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:36:23+00:00 2026-06-03T01:36:23+00:00

I have the following RelativeLayout <RelativeLayout android:layout_width=match_parent android:layout_height=match_parent android:layout_marginLeft=2dp android:layout_marginRight=5dp android:layout_marginBottom=5dp android:layout_marginTop=5dp> <TextView android:id=@+id/x_memtxtlay

  • 0

I have the following RelativeLayout

    <RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginLeft="2dp"
    android:layout_marginRight="5dp"
    android:layout_marginBottom="5dp"
    android:layout_marginTop="5dp">
        <TextView
            android:id="@+id/x_memtxtlay"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_toLeftOf="@+id/x_memamtlay"
            android:textColor="#000000"
            android:textSize="22sp"
            android:paddingLeft="3dp">
        </TextView>


        <EditText
            android:id="@+id/x_memamtlay"
            android:layout_height="40dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_width="70dp"
            android:inputType="number"
            android:singleLine="true"
            android:paddingLeft="2dp"
            android:paddingRight="2dp"
            android:background="@drawable/edittext_greybg"
            android:visibility="gone">
        </EditText>

        <TextView
            android:id="@+id/x_memamt"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:textColor="#000000"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:textSize="20sp"
            android:background="@drawable/number_fill">
        </TextView>

</RelativeLayout>

Now I have to set EditText(@+id/x_memamtlay) visibility to gone/visible and 2nd TextView(@+id/x_memamt) visibility to gone/visible regularly in my activity based on some requirements.Either EditText or TextView will be visible at a time.

Problem is, in 1st TextView(@+id/x_memtxtlay),

when I set android:layout_toLeftOf=”@+id/x_memamtlay” : (to left of EditText)

But when I set android:layout_toLeftOf=”@+id/x_memamt” : (to left of 2nd TextView)
enter image description here

How can I adjust the layout so that 1st TextView aligns left to both EditText and 2nd TextView.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:36:25+00:00Added an answer on June 3, 2026 at 1:36 am

    Try this just a minor change in your code::

     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginLeft="2dp"
        android:layout_marginRight="5dp"
        android:layout_marginBottom="5dp"
        android:layout_marginTop="5dp">
            <TextView
                android:id="@+id/x_memtxtlay"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                android:textColor="#000000"
                android:textSize="22sp"
                android:text="sdasdasd"
                android:layout_toLeftOf="@+id/x_memlay"
                android:paddingLeft="3dp">
            </TextView>
    <FrameLayout  android:id="@+id/x_memlay"
                android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true"
                android:layout_centerVertical="true">
         <EditText
                android:id="@+id/x_memamtlay"
                android:layout_height="40dp"
    
                android:layout_width="70dp"
                android:inputType="number"
                android:singleLine="true"
                android:paddingLeft="2dp"
                android:paddingRight="2dp"
    
    
                android:visibility="gone">
            </EditText>
    
            <TextView
                android:id="@+id/x_memamt"
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:textColor="#000000"
                android:paddingLeft="5dp"
                android:paddingRight="5dp"
                android:textSize="20sp"
    
            </TextView>
    </FrameLayout>
    
    
    
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following ToggleButton in xml: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=46dp android:gravity=center > <ToggleButton
I have the following layout: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:background=@drawable/aussie_bg_big > <ImageView android:id=@+id/titleImage android:layout_width=wrap_content
I have the following layout: <?xml version=1.0 encoding=utf-8?> <RelativeLayout android:id=@+navigate/RLayout android:layout_width=fill_parent android:layout_height=fill_parent android:background=#ABABAB xmlns:android=http://schemas.android.com/apk/res/android
I have the following XML: <?xml version=1.0 encoding=utf-8?> <RelativeLayout android:id=@+id/rl android:background=@color/red android:layout_width=fill_parent android:layout_height=fill_parent xmlns:android=http://schemas.android.com/apk/res/android>
I have the following layout in my xml file: <RelativeLayout android:layout_width=fill_parent android:layout_height=fill_parent> <FrameLayout android:id=@+id/logoLayout
I have used the following in android manifest. <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android xmlns:ads=http://schemas.android.com/apk/lib/com.google.ads
I have an Android Activity with a RelativeLayout and I have implemented the following
I have the following layout buttons.xml <?xml version=1.0 encoding=UTF-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/buttonsLayout android:layout_width=fill_parent android:layout_height=wrap_content
I have the following layout file: <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=wrap_content android:background=#FF0000
I have the following layout defined in XML: <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_height=wrap_content

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.