Android Studio 2.2 Gridlayout not working - android

I can understand maybe Android Studio 2.2 is different but I feel like it's not working at all with GridLayout, I'm watching thenewboston tutorial 17 for GridLayout, and when he makes it wrap around content then drag the buttons into it, it shows a bit of information over the mouse about where the button is going to be placed (Then shows green bars to indicate where the button is), mine doesn't do that and also it doesn't work at all. I'll include a gif of what I'm talking about.
Also, how do you enable the tooltips for the palette? and no I'm not talking about the quick docs but the mouse hover tip over the palette items.
Here is a gif https://gyazo.com/8a2bc1919f3d117238b7f52be11a2316
And also the error codes that pop up, one of them says view requires API Level 14 (Current min 9):<.GridLayout/>
And the other says
This Gridlayout view is useless (no children, no background, no id, no style)

Regarding dropping the button on the Grid... just drop the button on the GridLayout on the component tree (bottom left). Once you have the first item there you can use the grid as you'd normally expect it to work by moving the buttons around.

I realize that this question is a tad old, but also that it comes up quickly in a google search, so I hope that my solution can be of help to some one.
I was going through this same tutorial, and while I was never able to figure out if it's possible to enable the green lines or drag and drop properly into a GridLayout, I did find how to do it explicitly in the XML file.
In the tag for your button, simply add:
android:layout_row="X"
android:layout_column="X"
where x is any (positive) integer number from top to bottom for the row value, and left to right for the column value.
A less than ideal solution I know, but hopefully some one will benefit from this.

Related

Android Studio & Constraint Layout Editor Problems

I have watched numerous videos, including Google's own, and i'm really struggling with ConstraintLayout, it simply doesn't work for me, like it works in the online videos.
When I drop a textview onto the constraint layout editor, it jumps to the top right of the form. In the demo videos, it stays where it's dropped, and it's easy for those people to set up the relationships by dragging handles. For me, It's all up in the top right, and I can only get to 2 of the handles.
It gets worse if I then drop two more text views into the form, they are all now all the same size and all overlapped at the top. Whenever I use constraint layout, I end up tearing my hair out, and then giving up and going back to an older layout.
I really want to use constraintlayout, but clearly I am missing something really obvious here, but I can't figure out what.
Yes the drag and drop doesn't work well. For me I just use several steps to add a new view:
1. drag new view to the end of the view list window (not on the design view! design view will add unnecessary properties and is not clean)
2. select the new view, and name it! name is very important to constraint layout.
3. set the layout_constraint_xxx attributes from the property window
then it goes to the expected places.
Try disabling the experimental render engine and re enable it again

Android create edit text animation like Chrome

Chrome recently updated on Android. I believe to version 38 maybe?
The new tab search box translates into the Url Address box. I'm not quite sure how it does this.
This was a couple version older but found a post from: http://www.omgchrome.com/google-chrome-android-material-design-beta/ describing the details behind it:
http://i.imgur.com/FvCJ21k.gif
Any help would be appreciated. And I know this isn't an L Preview only thing, because its currently my production version of Chrome running on the latest version of KitKat 4.4.4.
From my observation, I might only give you idea what is used and idea about the math
Search EditText is set below the Google logo, both of them are wrapped inside some ScrollView, probably kind of ObservableScrollView.
Shrinking and lengthening of EditText is done by the amount of pixels (percentage) scrolled with respect to the Google Logo. Hence, is the logo faded-out/in.
Lengthening and shrinking is changing its right coordinate.
When the logo view is off screen, the EditText is set as custom view in the actionbar.
Returning to appropriate place is probably done if the logo is scrolled >= 50% it returns to the ActionBar/Toolbar, otherwise it is returned to its starting position.
Worth mentioning is that the EditText is not clickable during the scroll, so it could be ViewOverlay just for animating purposes.
I'm just doing the guesswork here.
Also do some reading on monitoring the scrollviews for such purposes here.

Android UI - views slider

I need an android component that will hold two views (one on top, and the second one ont he bottom). There will also be a slider between views.
It will look something like this:
View 1 is bigger than shown and user can expand it by moving down the separator (dark grey rectangle on the picture above). While expanding, View 2 will go down and will not be covered by View 1 (not like in android's notification panel).
Is there some kind of ready to use library for this? If not - could you point me in the right direction how to achieve this?
I haven't done this but I think you can scale the view by draggin. see this to know about this method.
Your question is from years ago, but I've had the same problem recently. Now that we can do nice things with the Design library with scrolling and resizing, this question has become even more important.
So I'd like to point out a library called SubAppBarPanel, that allows you to expand an area from below the app bar. When it's expanded, it pushes down the main content (see GIF).

Android UI question. Implementation guidance

I'm working on implementing a UI for an Android application, and I wanted to ask if there is already something in the native widgets to accomplish most of what I'm trying to do.
The application that I'm working on performs 15 different tasks that can be divided into 3 different groups. (5 tasks per group) I have 18 icon images (3 for the groups and 15 for the individual tasks) and I want to be able to panel these icons (starting with the groups) like this:
I want the next icon visible below and above (if further down than the first icon) and swipe to go to the next icon
Once an icon is clicked, the panels slide to the side, exposing the next layer (the specific 5 tasks for the selected group) with the selected group still visible on the side:
From there, the user can tell at a glance what group they are in, what the current, next and previous selectable tasks are, and that by swiping right, they can get back to the group selection.
What types of widgets would I need to look into in order to accomplish something like this? Are there already pre-built lists to do these activities?
Thanks for any guidance!
You can get close with a LinearLayout of ImageView widgets and a ScrollView (vertical) or HorizontalScrollView. However, it will not give you the desired "centered image with bits of the previous/next images" effect -- it will be wherever the user positions it.
You can get close with a Gallery. However, it will not give you the vertical orientation, and it will always give you a fixed set of full options to the sides, not the partial images that you seek.
If it's gotta be the way you describe it, you'll have to roll it yourself. Gestures and animations should give you the desired effect.
Have you taken a look at ViewFlipper? http://developer.android.com/reference/android/widget/ViewFlipper.html This will give the side by side effect but you will have to make custom views for each group to populate it with the proper icons.
I'd use a ListActivity for the first 3 top level items. This won't give you the auto centering effect that you'll probably want, but you should be able to look at the Gallery source code, which can be found here, and make some modifications to the ListActivity so that it autocenters.
For the next items, I'd add an onClick and a GestureListener so you can navigate to another activity with another list view. Since you know where you came from (add some data to your Intent) you can set the color rectangle on the left so that it appears that you have just swiped the whole view left.
If you need to customize the animation, you can call this:
overridePendingTransition(R.anim.slide_left_entry, R.anim.slide_left_exit);
To make the yellow icon look good as it animates to the left, I'd change the list bounds (on the first activity) to have no margins, and change the yellow icon to have square right edges - This will make the small yellow rectangle on the next activity appear to be part of the first activity.
It should be relatively easy to mock this up to see if it's going to work properly for you.
Good luck!
EDIT: Ok, so I've made a basic project that does most of what you want.
here is the link to the eclipse project file. I was going to put the source up here, but there's a bit much to display.
What you still have to do:
Tweak animation
Configure the layer lists to display the correct colors
Add information to the top level intent for the sub-activity to be able to configure itself.
Quite a few other small things.
I think I've got the main stuff done. I've also added the gesture listener I talked about, although re-reading your question, you actually didn't ask for that. Since it's cool, I left it in.
Good Luck once again!!
Have you thought of launching Activities with different view configurations? You can switch from one activity to another with a gesture and you can Animate the views. What your UI looks like to me is a bunch of screens with affordances that show the other screens. So one Activity per screen maybe the same in different configurations or something like that.

Which Android control to use?

I'm taking my first steps in Android programming.
My application is to create entries in a database. For this task I have created a new Activity. All is fine - but I don't really like how it looks.
Currently, the emulator shows this:
I'd like to have something similar to the "New Contact" Activity:
Buttons at the bottom of the window, not directly below the other controls (I'll hopefully figure that out myself)
Buttons within a nice "box" like shown in the screenshot (what's the control hosting the buttons here?)
When soft-keyboard is displayed, the buttons should "move up". If there's not enough room, the entire area should be scrollable (I'll try and figure that out myself too)
Sample can be seen here:
Which control hosts the buttons in the above "New contact" screenshot? I'd like to use the same for my buttons.
One way to figure out what an existing activity does is to use hierarchyviewer and examine the activity's contents.
Another way to figure out what a native Android activity does is to look at the source code. In this case, it would appear that the buttons are inside of a horizontal LinearLayout with style="#android:style/ButtonBar" to give the silver sheen. That style, in turn, uses #android:drawable/bottom_bar as its background. That image can be found in your SDK installation -- go to the platform directory of your choice, then data/res/drawable-hdpi and data/res/drawable-mdpi for the two versions.
The contacts layout looks like a ListView sitting on top of some sort of RelativeLayout or LinearLayout housing the buttons. The silver background may simply have been set using android:background on the Layout itself (layouts are views).
I found that the commonsware books are excellent resources for getting started and have good examples for this type of layout.
Hey, this is a little late, and I know you've already got the silver bar you wanted, which is all good, but I've stumbled upon a really good guide on controlling the soft keyboard for best user experience. It covers, among other things, how to make the visible area resize to fit the button bar in the view while typing, which is done by specifying the activity in the manifest file like so:
<activity android:name=".MyActivity" android:windowSoftInputMode="resize" />
I really recommend reading it, it covers a lot more helpful stuff than just that. Hope that helps; I couldn't see that anyone else has answered that particular part of your question.
You can put them in LinearLayout and assign weight of 1 to each of the buttons.
Also if you own dev phone / or want to see UI of the application in emulator - there is a very cool tool call hierarchyviewer
http://developer.android.com/guide/developing/tools/hierarchy-viewer.html
and you can see how UI of app you like has been laydown.

Categories

Resources