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();
    }
    
}

28 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. Get today replays online tambayan ofw all the replays are avaialable for you which you will be watch online in a single click.

    ReplyDelete
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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

  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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


  20. 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
  21. 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
  22. 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
  23. Gambling with money that’s already earmarked for bills like meals, 메리트카지노 rent, or tuition is a significant mistake. Throw away a small pair when you have four cards to a flush or three cards to a royal flush. By checking this field, you agree to the Terms of Use and Privacy Policy & to obtain electronic communications from Dummies.com, which can include advertising promotions, information and updates. Grab your lucky numbers and head over to Red Wind Casino to grab your share of Keno jackpots. Ask about recreation specials for Wild Wind Keno, Speed Keno or Progressive Keno. International Game Technology PLC is licensed and controlled in Great Britain by the Gambling Commission beneath account number 41794.

    ReplyDelete