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

  • Home
  • SEARCH
  • 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 6886845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:48:38+00:00 2026-05-27T05:48:38+00:00

I want set a border to Relativelayout. I make relativelayout clickable and use selector

  • 0

I want set a border to Relativelayout. I make relativelayout clickable and use selector for changing selected color, also I use shape for rounding corners of layout. But when I select the layou the shape takes all background including the border. I can’t find a way for solving this problem.

This is my main.xml

<RelativeLayout android:id="@+id/map_refresh"
                android:layout_height="fill_parent" android:layout_width="wrap_content" 
                android:background="@drawable/settings_selector_up" 
                android:padding="15dp"
                android:layout_marginLeft="15dip" android:layout_marginRight="15dip" android:layout_marginTop="5dip">
                <TextView android:id="@+id/Text1" 
                    android:layout_height="wrap_content" android:layout_width="wrap_content"
                    android:text="Map refresh period">
                </TextView>
                <TextView android:id="@+id/TextView09" 
                    android:layout_height="wrap_content" android:layout_width="wrap_content"
                    android:text="1 min" 
                    android:layout_alignParentRight="true"
                    android:paddingRight="5dp">
                </TextView>
            </RelativeLayout>
</LinearLayout>

this is my settings_selector_up.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Non focused states -->
    <item android:state_focused="false" android:state_selected="false"
        android:state_pressed="false" android:background="@drawable/settings_border_roundup" />
    <item android:state_focused="false" android:state_selected="true"
        android:state_pressed="false" android:drawable="@drawable/settings_border_roundup" />

    <!-- Focused states -->
    <item android:state_focused="true" android:state_selected="false"
        android:state_pressed="false" android:drawable="@drawable/settings_border_roundup" />
    <item android:state_focused="true" android:state_selected="true"
        android:state_pressed="false" android:drawable="@drawable/settings_border_roundup" />

    <!-- Pressed -->
    <item android:state_selected="true" android:state_pressed="true"
        android:drawable="@drawable/selector_pressed" > 
        </item>
    <item android:state_pressed="true" android:drawable="@drawable/list_selector_pressed" />
</selector>

And this is my selector_pressed

<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#E6E6E6"></solid>
    <corners android:radius ="10dp" />
</shape>

Is there a way receive same result as we go for example using listselector in listView (in listview when I select the listitem only background color changed but border stayed unchanged).

  • 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-05-27T05:48:38+00:00Added an answer on May 27, 2026 at 5:48 am

    Put the whole thing in another parent layout that handles the drawing of the border, like this:

    <FrameLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="your background 9-patch or shape of the border"
        android:padding="some padding value so the border looks ok">
    
        < Your RelativeLayout without the border stuff >
    
    </FrameLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to set the background color of JButton. For that I use setBackground()
I want to set a border color and border style ( like solid or
I want to set border color of field set. I am using class but
I have google map infowindow,i want to set border radius to infowindow. so how
I want to set an image as border when a text box has got
I am having GtkImage to which i want to set visible border like a
How does one set the UITableView Section border color? I have tried and cant
I want to set the border of <tr> to yellow. I can set the
I want to have a table border (which I can set using css, rather
I want to set border for a div, Using: -webkit-border-radius working fine on Chrome

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.