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 8644627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:20:42+00:00 2026-06-12T12:20:42+00:00

I would like to have a solution in xml or a keyword for what

  • 0

I would like to have a solution in xml or a keyword for what to search to solve my problem:

I have multiple screens. Each screen has his own xml in layout folder. For eg a part of the code :

   <RelativeLayout
        android:id="@+id/headerLayout"
        android:layout_width="fill_parent"
        android:layout_height="80dp"
        android:background="@drawable/header" >

        <Button
            android:id="@+id/btBack"
            android:layout_width="55dp"
            android:layout_height="33dp"
            android:layout_alignParentLeft="true"
            android:layout_marginLeft="10dip"
            android:layout_marginTop="10dip"
            android:background="@drawable/bt_back"
             />

    </RelativeLayout>

now, I would like to change the "@drawable/header" value runtime when is a rotation, prefferable to configure and Android change not me in Java code. The same thing is done with
"@drawable/bt_back", which is a bt_back.xml file at drawable folder and has a selector. His content is here:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- selected state -->
    <item android:drawable="@drawable/bt_back_pressed" android:state_pressed="true" android:state_selected="false"/>
    <item android:drawable="@drawable/bt_back_pressed" android:state_pressed="false" android:state_selected="true"/>
    <item android:drawable="@drawable/bt_back_pressed" android:state_pressed="true" android:state_selected="true"/>
    <!-- unselected state (default) -->
    <item android:drawable="@drawable/bt_back_normal"/>

</selector>

Now in folder what I want drawable-hdpi, drawable-ldpi, I just need to put those 2 files and the android system is auto-handling the image changes for pressed and normal state depending on user device dpi.

The same thing I would like to have for header for rotation from portrait and landscape. Eg it should alternate the header_port.png to header-land.png.

How is possible? Any ideas?

I don’t wand different .xml layout for landscape, nor digg in java code.
Maybe in different folder the resources for header, described here ? port and land?

  • 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-12T12:20:43+00:00Added an answer on June 12, 2026 at 12:20 pm

    You are able to create a drawable-land-hdpi directory. Put your landscape versions in the qualified folders and android should automatically load them for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a SharePoint solution that uses a standard task list. We would like
I would like to know what solution I can use in order to have
Currently I have a website and database solution, however I would like to take
I have a lot of projects in my .NET solution. I would like to
So in my project i would like have a nice treeview that has images.
I have below XML and would like to iterate through the element as such
I have several times ran into the same problem, and I would like to
I have some XML files on my PYTHONPATH that I would like to load
I have a feed here http://artistdata.sonicbids.com/my-lady-four/shows/xml/past that I would like to convert to XHTML.
I have a complete XML document in a string and would like a Document

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.