How to control the width or the visibility of an activity - java

I'm using this awesome library Dragger to add drag features to my activity, but is there a way to limit the width of the activity when it shows up or dragged..!? I don't want it to fill the entire screen..! kinda like the drawer navigation menu (see the pic below).
I was thinking of Dialog Activity, but it seems to be concerned with dialogs only and won't allow filling the other 3 sides or I not fully understand it..!
Any help?

Activity is not a view, so it does not have a size. Its' layout views do however.
You can try changing their sizes. Or, as it is an animation lib, you can try modifying existing or adding your own animations where views change sizes when moving. You can modify this param:
<item name="android:windowAnimationStyle">#null</item>
This might help you.

Related

How to make dimming effect of Youtube when motionLayout transitions from start to end?

I'm trying to make this effect but has no idea, how to achieve it:
My idea is to have a Frame Layout which wraps the video fragment, and the Video fragment has motion Layout as its root layout. So, Frame Layout is in main Activity, but motion Layout is inside a .xml file, which will soon be inflated as the Video fragment's layout. It looks something like this (The frag container will match parent in its width and height):
My questions are:
Is this a good idea to make this transition?
How to make the dimming effects that YouTube has? I'm planning to use this Listener for tracking the transition but has no idea how to make the slowly dimming effect :(. MotionLayout.TransitionListener
Any idea?
One way I can think of cover the screen with a a View that is
#000000 and transition the views color to #FF000000 using a custom Attribute.
The View would need to be gone, Invisible, or translationZ = -1 at the start

How to make a Bottom Navigation bar with ImageView instead of Menu Items?

How can I make a working bottom navigation bar with ImageViews in a LinearLayout(Horizontal) With fragments ? instead of menu items.
if already exist then please share the source code. Please help quickly :)
Or the Question could be this :
https://github.com/qhutch/BottomSheetLayout/issues/12#issue-576279364
Oh, I found my solution not exactly but this is what I want...
I add that Bottom Navigation View in a LinearLayout(horizontal) and I delete all default Styles from BottomNavigationView. So now this is not looking like a card view. After this, I add an ImageView in the LinearLayout with a weight of a ratio of 1:3 (for 4 icons ). Now I can use effects and designs on my LinearLayout. And it is looking like how I wish. 😌
[Note: For horizontally rotated screen LinearLayout, ImageView, BottomNavigationView 's width:match-parent]

How to expand a cardView to show hidden elements in android with a dropping animation?

I am beginner in android animations and therefore, am wondering exactly how can I implement something like expand a cardView to show hidden options or elements.
For example: a post in social networking, we have a cardView holding the post info. it also has likes and comments buttons/options. When user taps on comments button the view should expand a little say certain height and show the comments and shrink back when the same button is tapped again.
I am listing my posts using RecyclerView in a Fragment using a CardView. I am looking for a soft animation along with expanding and shrinking back to original place or size.
Below is a screenshot that might help you understand what exactly I want:
How to do this? Will you please provide me a small snippet of code?
use wrap content as height of cardview and use textview inside it below title, so on click make the textview visible and invisible.
And use android:animateLayoutChanges="true" in parent layout.

How to create this Setting Layout in android?

I want to create a settting UI like this in android:
Questions:
How to create the layout? I believe it's a Vertical LinearLayout containing some of TextView with Divider set, is that right?
How to create sub-textview? (see the image above)
How to create a checkbox which aligned at right? (again, see the image above)
Look at the image above, the "Keypress popup" can be clicked and it will show up a dialog. How to create a clickable TextView? I have tried giving android:onClick on the TextView, but nothing happened when I clicked the TextView.
PreferenceActivity will help you to implement all these very easily. Go through this and this tutorials.
PreferenceFragment should be used post Honeycomb.

Eclipse android widget moving

I am designing my activity screen using eclipse but whenever I move an object e.g. a button it snaps around and I find it hard to position things where i want them.
Is there some setting I can change as as soon as I add a second button it snaps the other button to another position it is so annoying!
Also if I have an image button why can't i resize this, even with a normal button if i try to make it larger it just fits to the text and wont make the button bigger or it just flicks to a random place on the activity?
thanks
Probably you're trying to place components freely in the View but you're not considering the LayoutManager behavior. If you try to position your component in a LinearLayout, for example, the components will be placed following its rules, and these components will not stay where you drop them.
Try to understand better how the layouts works on Android. But for now, the AbsoluteLayout or RelativeLayout may be what you're looking for.
About the components size, you'll need to understand better how to use layout properties for these components. See the question How to size buttons for more information.

Categories