UI Trick: Sliding content

Here is a small trick that I use sometimes to show a related content in an activity. In the back of my mind, my intention might be to mimic the iphone's presentModalViewController. This would specifically be useful when you have a list of items which users might repeatedly click items to view an Expanded view of them. I prefer to use this instead of a new Activity.
The basic idea is simple: Use a SlidingDrawer with an invisible handle.

In your activity add the SlidingDrawer to your content view. I usually set the Handle's height and width to 0dp. Then when you want to show the Expanded View you can just open the drawer.

To hide or show the drawer is pretty straight forward using animateOpen and animateClose of the SlidingDrawer. It is preferable to wrap these calls in your own functions in order to be able to add your own code upon closing/opening the drawer. I know that we can use the  OnDrawerOpenListener and OnDrawerCloseListener: just a matter of taste. Just wrap them in your own calls:


public void showDrawer() {
 mDrawer.animateOpen();
}
public void hideDrawer() {
 mDrawer.animateClose();
}


An important point to keep in mind is to handle the onBackPressed() of the activity that contains such a drawer

@Override
public void onBackPressed() {
 if(mDrawer.isOpened())
  hideDrawer();
 else
  super.onBackPressed();
}


Click here for Sample Project + Source Code (download)

Here is the full code of the activity.

public class MainActivity extends Activity {
 SlidingDrawer mDrawer;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mDrawer = (SlidingDrawer) findViewById(R.id.drawer);
        findViewById(R.id.buttonshow).setOnClickListener(new OnClickListener() {

   public void onClick(View v) {
    showDrawer();
   }
        });
        findViewById(R.id.buttonhide).setOnClickListener(new OnClickListener() {

   public void onClick(View v) {
    hideDrawer();
   }
        });
    }

    public void showDrawer() {
     mDrawer.animateOpen();
    }
    public void hideDrawer() {
     mDrawer.animateClose();
    }
    
    @Override
    public void onBackPressed() {
     if(mDrawer.isOpened())
      hideDrawer();
     else
      super.onBackPressed();
    }
    
}

42 comments:

  1. You might have a look on a library I'm working to get expandable views in Android: https://github.com/AndreasZeiser/Jalousie

    ReplyDelete
    Replies
    1. I will check it out. Downloading library and sample.

      Delete
    2. I have posted a comment in the issue tracker.

      Delete
  2. Obat Aborsi,, Obat Penggugur Kandungan,,
    Nice bag you can earn money from that
    Thanks for your posting
    Visit me @, Jual Obat Aborsi,,

    ReplyDelete
  3. Get today replays online tambayan ofw all the replays are avaialable for you which you will be watch online in a single click.

    ReplyDelete
  4. very nice blogs!!! i have to learning for lot of information for this sites...Sharing for wonderful information. Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing

    carboxyl
    utsa blackboard
    linear interpolation
    antiderivative calculator
    anesthesia technician course syllabus
    What are the Scientific Reasons for Choosing Printed Books
    favourite fruit mango
    bds full form

    ReplyDelete
  5. If you want to keep children engaged, indoor activity centers provide everything. Similar to bowling alleys as well as arcades for games indoor activities centres could benefit from a vibrant fun neon sign that will give a visual appeal to the place.

    Indoor centres could include anything from rock climbingto trampoline areas and would look more appealing with a neon sign that is themed placed in the wall.With restrictions slowly ending across the UK It's possible to say that both people and businesses alike are taking a breath of satisfaction that soon things will return to normal. A lot of our favorite things are returning such as the ability to sit at a bar , to going to an event of a huge scale.

    https://neonsignshistory.blogspot.com/2021/09/the-golden-age-of-neon.html

    ReplyDelete
  6. It doesn't matter if you're an organisation planning to resume corporate events or you've been busy to prepare for the return of the annual music festival now is the time to start moving once more! With this in mind, it's crucial to begin contemplating the decor for your event and the best way create this year's celebration the most memorable to date.https://neoncave.co.uk

    ReplyDelete
  7. I'm a Certified Social Media Manager, Strategist, Keynote Speaker, Organic Specialist, and Marketer! Blogging services as a creative outlet for me. Running, hiking, and skiing are some of my favourite ways to unwind. My always-present orange glasses, a tribute to my Dutch origin, will help you distinguish me on stage and online.https://neonvibesuk.weebly.com

    ReplyDelete
  8. Poker แห่งเดียวที่ พูดคุยแลกเปลี่ยนความคิดเห็นในทุกประเด็น poker online สูตรการเล่น โป๊กเกอร์ เรารวบรวมเทคนิคการเล่นFree Texas Holdem Poker the way YOU want to play! Join the world's most popular online Poker game with more tables,

    ReplyDelete
  9. Are you looking for a reliable method to make a 3-color scheme look more balanced? Keep it to 60% for your primary color and 30% for your secondary colour , and 10 percent for the accent colour and you'll be able to get it wrong. If you want to add a fourth color to the mix, you can split the secondary colour , or at a minimum to the dominant colour but not the accent.https://www.scarsocial.com/bring-customers-to-the-door-with-a-neon-open-sign/

    ReplyDelete
  10. Instagram, like other social networking networks, may have login troubles from time to time. As a user, it might be inconvenient, and it can occur on mobile devices as well as PCs or tablets. You could be seeking for answers if you've had one of these problems and don't know how to remedy it. In this post, we'll go through a few major Instagram login difficulties and how to solve them so you can get back into your account.
    https://www.atoallinks.com/2021/going-coastal-decorating-ideas-for-a-beach-room/

    ReplyDelete
  11. If you haven't been using Instagram for marketing, consider the following data. Every month, the platform has over a billion visitors. 81 percent of those who use it do so to look for services and products. Every day, nearly 500 million individuals view Instagram stories. Another 58% say Instagram posts are responsible for their interest in a particular brand or product. A large number of influencers use the platform to assist firms promote their products. It's crucial to use the correct marketing strategies. For some advice, we spoke with experts who provide blogger outreach services. This is what we discovered.
    https://www.thetechbizz.com/6-reasons-why-you-need-an-adjustable-bed/

    ReplyDelete
  12. Learn how the Instagram algorithm works.
    Many Instagram users initially panicked about switching from a chronograph logical feed to a ranked timeline. However, after changing the post, on average, 50% more subscribers are viewed than before. So, forget about learning how to beat the Instagram algorithm. Instead, focus on learning how to use the system to your advantage. What is displayed on each person's timeline is determined by six factors: interest, timeliness, relationship, frequency, subscription, and usage.
    https://webinkeys.com/glass-neon-vs-led-neon-signs/

    ReplyDelete
  13. How to get more Instagram followers
    Read on to find the best ideas with tools and examples that can help you grow and connect with Instagram marketing users. Best practices to increase the number of Instagram users. The Importance of Uniquely Voiced Instagram How to post regularly to engage your audience. We spend hours creating and creating Instagram content. If you click the Share button for a moment, the world will be fine. Did you know that you are promoting something good? Then the radio shuts down or some customers get positive feedback and comments. But how do you get more Instagram followers without posting great content? There are no standard Instagram installation instructions. However, there are best practices to help you reach a wider audience and attract new users.
    https://znoley.com/ideas-for-small-spaces/

    ReplyDelete
  14. A strong guarantee ought to be anticipated. Some corporations provide a 365 days components-best guarantee, even as a few groups provide 3-12 months warranties for components and exertions best, but the great corporations provide 3-12 months components and exertions guarantee. It is critical to discover a enterprise this is inclined to provide an extremely good guarantee and stand through their merchandise. Because symptoms and symptoms are the number one affect that your purchaser receives of your employer It is the maximum green funding in advertising and marketing your employer. It is hard to locate price for a super signal whilst you're simply growing a today's enterprise However, the significance of making a brilliant photo to your today's enterprise couldn't be overemphasized. Signs that aren't nicely designed may be a big drawback to any new undertaking. Here is a hard breakdown of expenses that will help you pick the form of signal you agree with will paintings to your employer.
    https://www.thedailyguides.com/tips-on-creating-your-own-neon-sign/

    ReplyDelete
  15. Design to Your Routine
    With just a handful of furniture items and accessories, you'll create your daily arrival and departure process effortless. "Typically, it's not a huge space, so you're working with a limited number of pieces," said Mr. Ford. If you're the type of person who tends to spill everything as you enter your door "a console with drawers is great, because it's a nice place to hide your keys and mail," Mr. Ford said. If you're not in possession of cabinets, an empty bowl tray, or any other container that is sculptural could be used as a catchall to keep things in order. A stool or bench as well as a few that can slide underneath the console will be a comfortable place to relax while you put on shoes, and occupying a small flooring space. A second option is a mirror mounted to the wall as suggested by the Mr. Ford. "It gives you one last chance to check yourself before you walk out the door."

    https://meruwin.com/rugs-are-required-for-your-living-space/

    ReplyDelete
  16. O GA4 categoriza os usuários que estiveram em mais de um site, concluíram um evento ou conversão ou que estão no site por mais de 10 segundos, como "usuários engajados". Isso geralmente é maior do que a taxa de rejeição, pois certas sessões que poderiam ser consideradas rejeições agora são categorizadas como um usuário ativo. A visão geral do engajamento no GA4 fornece uma visão geral de quantos usuários estão se engajando com o seu conteúdo e duração, o que pode ser uma alternativa eficaz para a medição da taxa de rejeição do GA. https://myanimelist.net/profile/juliana1132

    ReplyDelete
  17. most indifferent of people. If you walk through the town or city and see the channel letter signs, they are the ones that you see first, and you'll be able to be able to recall when you look back. Each letter is on their own, and casts shadows to ensure that it is easy to discern them from the structures in which they are placed. The majority of letters in a channel are illuminated with LED lighting. Since these kinds of signs are noticeable they are very popular across a wide range of organizations and businesses including shops and hotels to schools and government structures.

    https://capsdoc.com/2021/11/23/lets-honor-the-queens/?fbclid=IwAR3bGaMKtw-ADpyfTGGPrycF_vqdEhOUcE4qd7mMy4Bjsws6uqOxtyvot20

    ReplyDelete

  18. There's no way around the calculation: If you splash out on a chair that is pricey and you'll be left with less to spend on the rest of your home. "You want to make sure you're being strategic about how you spend your money," said Mr. Ford. "A budget gives you a road map for how to divide the costs of things between rooms." It is possible to however make an exception in the event that you come across a unique dinner table said however, to purchase it, you must think about other areas you could reduce your spending.

    https://masofiy.com/tips-for-choosing-the-perfect-stylish-rug/

    ReplyDelete
  19. Eu realmente acredito que lendo as sugestões e chats do Hank sobre as últimas tendências pode fazer de 2022 o ano em que você se concentra no sistema de atendimento ao cliente para a segurança de convites, valor em comunalidade, adequação de custos e as incríveis possibilidades de transformação.
    https://www.designspiration.com/jjuliana1290/saves/

    ReplyDelete
  20. Sua dupla opção de informar as pessoas não deve ser exclusiva. Encontre potenciais endossantes que estejam ansiosos para levar sua men a bordo e devem ser capazes de aceitá-los o mais rápido possível! Certifique-se de fornecer valor e entretenimento.
    https://www.diigo.com/profile/juliana455623

    ReplyDelete
  21. The channel letter signal is a few of the pinnacle attractive symptoms and symptoms that may be observed through even the maximum inquisitive of humans. If you stroll thru the city or metropolis and notice the channel letter symptoms and symptoms, they may be those which you first be aware and you will be capable of preserve in thoughts whilst you appearance back. Each letter is on its personal, growing shadows to make certain which you are capable of effortlessly parent them from the systems wherein they may be positioned. The majority of letters in a channel are illuminated through LED lightning. Because those types of symptoms and symptoms are substantive they may be pretty famous throughout a extensive variety of corporations and agencies which includes stores and motels to authorities and college homes.

    https://www.forbestoday.org/enhance-your-mood-with-led-neon-lighting-to-decorate-your-home/

    ReplyDelete
  22. Moving into a brand new home is among the most exciting experiences in life, but it's also an uneasy time particularly when decorating. What can you do to ensure that your home looks the best it can while expressing your individual style? If you do it right, you'll be able to have an inviting, comfortable home. If you don't do it right, you'll have a jumble of fabrics, furniture as well as paint colors that don't blend into a harmonious total. With a bit of planning and following the exact techniques employed by professionals in interior design You'll have a more likelihood of getting it right.

    https://wimafy.com/kitchen-design-ideas-that-will-absolutely-stun-you/

    ReplyDelete
  23. What’s so hard approximately shopping for a neon sign?”, you'll be surprised by way of how not unusual that query is each time you are attempting to choose one. The truth is, you don’t have too many components to keep in mind or decisions to make, however the few ones you need to address can take a lot of time and give you a few complications.

    https://lebenn.com/why-are-custom-neon-signs-uk-so-popular/

    ReplyDelete
  24. Decorators understand that choosing furniture with the aesthetic enchantment will accentuate the interior diagram of your home and delight the senses. The aesthetic of a piece of fixtures refers to its splendor and artistry. While some title manufacturer manufacturers are better acknowledged for value and functionality, others, like Bernhardt, Craft master and Natuzzi are also acknowledged for their extremely good aesthetic design. If you choose your domestic to stand out and express your good taste, seem for fixtures pieces that enchantment to your emotions and senses.

    https://wonvey.com/cream-kitchen-ideas-and-wood/

    ReplyDelete
  25. Neon signs and symptoms are every other small company’s favored because it’s versatile, less costly and easy-to-find. The element is, earlier than you begin leaping into the bandwagon of neon signal fans, you ought to first understand what it is, why it is one of the first-class picks for an outside sign, and most of all, why it is economically friendly.

    https://www.flipposting.com/4-custom-led-sign-types-every-business-needs/

    ReplyDelete
  26. Leather Folding Stool: Folding stools are perfect for small spaces, in a position to be packed up and saved away without difficulty between uses. This diagram aspects a sturdy rubber wood physique and a gray vegan leather seat – additionally accessible in light brown. Use as a baggage rack, a vanity seat, or maintain a small collection folded away to accommodate larger gatherings.

    https://www.justgetblogging.com/navy-blue-and-grey-kitchen-ideas/

    ReplyDelete
  27. Less is More One of the most important errors that wedding ceremony planners make whilst setting up the decorations for a marriage goes overboard with the decoration. You’ll need to discover a balanced degree among ‘minimum and down stated and ‘over the pinnacle and exaggerated’. After all, it's miles your wedding ceremony and the worst issue that might manifest is an immoderate mild up neon signal stealing the show!

    custom neon signs uk

    ReplyDelete
  28. With the solstice simply behind us, we welcome in the Winter months. A time for getting at ease at home, making the comfort of our interiors all the extra important. A location where you can sink into a sumptuous armchair to experience the crackle of an open fire. A place the place you can wake blissfully unaware of the cool crisp air outside, snuggled deep underneath your quilt cocooned in the remaining remedy of your bed.

    https://ramofy.com/how-to-choose-childrens-bedroom-furniture/

    ReplyDelete
  29. Reclaim, reuse and recycle, with a local weather emergency on our fingers we have to be extra aware in all our choices. 2022 interiors sketch tendencies see a sharp upward push in the use of recycled or reclaimed fabric such as wood and glass. So as nicely as looking completely breathtaking, you can take satisfaction in understanding these have been the eco-conscious choice.

    https://postpear.com/wooden-tables-for-transitional-design/

    ReplyDelete
  30. The majority of neon signs can be fixed in the event of a problem that is related to the intensity of the light, or when you've got a minor issue with the gas. Also, if you think a specific component of the sign requires replacement, it shouldn't require too much effort.

    https://tensionmatleyaar.com/why-neon-signs-are-the-best-home-decor/

    ReplyDelete
  31. It is essential to have a practical dining room lighting fixture however, it must provide the perfect atmosphere. It's too bright and it'll be like a cafeteria in a school. If it's too dark, it's impossible to see clearly enough to prepare dinner. In the end, remember that you require different kinds of lighting fixtures for dining rooms.

    https://articlegood.com/hall-decoration-ideas-to-spruce-up-your-entryway/

    ReplyDelete
  32. The majority of the times bathrooms and kitchens are the two rooms of an apartment that can are the most influential on the sale price. Professional home-stagers and realtors will say that these are the rooms that buyers look at first and are on the top of their list. If you're thinking of selling your house now take extra care of these areas.

    https://www.joinarticles.com/how-do-you-measure-for-the-size-of-a-sofa-5-experts-offer-their-best-strategies/

    ReplyDelete


  33. To develop your group, find and track people who are at this point locally. The following are a couple of clues to dismiss you from Increment your group with people you know. Welcome your buddies, family, and clients to follow your business account. Add an association with your Instagram profile on your site and email signature so people can without a very remarkable stretch track down it. For example, Maria invites family, associates, and clients to follow Fortunate Bush on Instagram.




    www.setuppost.com/?p=17735&preview=true

    ReplyDelete
  34. halema11223 halemas11223April 22, 2022 at 11:14 PM

    TikTok lets users create videos and upload them to the application. Users can add filters and other elements to make their videos more attractive or more commercially viable. It covers a broad range of topics, including home improvement, comedy the conspiracy theory, and much more.


    People can join creators' accounts, leave comments on videos, like videos and swipe down or up to switch videos. Brands can set up an individual TikTok account to increase organic reach or make TikToks for ads sponsored by advertisers.

    https://www.enrollblog.com/?p=15859&preview=true

    ReplyDelete
  35. Facebook is an ideal choice on all "lower funnel" strategies, especially for conversion-oriented or e-commerce-based campaigns in which the transaction will occur outside of the website on a different site.

    Instagram users are generally earlier in their journey to consider and are more likely to stay within the Instagram platform.

    If your content is more useful than inspiring and driving the in-portal activity (e.g. shares, comments) are more crucial than other portal visits, think about running across both of these platforms.
    https://econarticle.com/unbeatable-instagram-marketing-strategies/

    ReplyDelete