Review UI Widget from Google Play - android-widget

I need to implement a Reviews widget in my application, similar to that seen in Google Play. Image Below:
Are there any components our there that make it easier to do this? It would save time & trouble of implementing my own version.
Thanks

I would create a custom layout for that.
A TextField for stars information, a progress bar to show the number of stars and another TextField to show the number of ratings. Everything rapped on a LinearLayout (orientation = horizontal) for proper alignment.

I used a custom layout for this as cmota recommended.
The labels for the stars are a series of TextViews within a Relative layout
The rating bars are Imageviews in a Linearlayouts.
Code snippet:
ImageView ratingOne = (ImageView) ratingsView.findViewById(R.id.ratingOne);
<LinearLayout
android:layout_width="match_parent"
android:layout_height="15dp"
android:background="#android:color/white"
>
<ImageView
android:id="#+id/ratings_length_one"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:background="#color/orange" />
</LinearLayout>
Each imageview has a fixed height : for example i use 15dp above
The width of the imageview is the my rating count
Then i change the layoutParams for each imageView according to the values
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(myRatingCount, ratingOne.getHeight());
ratingOne.setLayoutParams(layoutParams);

Implement RatingBar in android.
some sample links
http://www.mkyong.com/android/android-rating-bar-example/
http://www.learn-android-easily.com/2013/08/android-ratingbar-example.html
http://examples.javacodegeeks.com/android/core/ui/ratingbar/android-rating-bar-example/

Related

How can i solve the problem of missing constraints in constraint layout

The view is not constrained. It only has design time positions, so it will jump to (0,0) at runtime
The attributes are not applied at runtime, so if you push your layout on a device, the widgets may appear in a different location than shown in the editor.
You need to give your view both vertical and horizontal constraints so in the run time he will have its position relative to the screen. If you won't do it your view will have no vertical/horizontal place to be and will jump from its location to the start if the screen.
You can do it like this for example:
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
Also, you can check the official documentation for more information.

Android Studio Preview Window - Render ListView Item Template

In Android Studio, while working in Text mode for a view i have the "Preview" window active to the right. When adding a listview to the view it renders a default list. I have a custom template which is used at runtime but is it possible to have the preview window show me my template at design time?
Thanks
Add the tools namespace to your xml layout:
xmlns:tools="http://schemas.android.com/tools"
next you can specify the listitem layout like this:
tools:listitem="#layout/mycustom_listitem"
Full example:
<ListView
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/lv_contactslist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:listitem="#layout/listitem_contact" />
For a graphical way, have a look at this stackoverflow post

Vertical oriented Metro WinJS ListView in Grouped Mode

I'm banging my head against the wall trying to implement a ListView with grouped items that renders like the WP7 LongListSelector shown below. I've tried adding a win-vertical class to the element with the data-win-control="WinJS.UI.ListView" but since win-vertical seems to only apply to the viewport that didn't work. Any help would be greatly appreciated.
What kind of ListView Layout are you using? Using ListLayout instead of GridLayout does change the scroll direction from Horizontal to Vertical. But I don't see an easy way to add a group header for ListLayout list view. For GridLayout, there is a groupHeaderPosition property, but ListLayout object doesn't have this property. (Someone actually complained about the same thing.. at the end of this page)So, you might need to hack around for the group names by adding a dummy "group name" item into your data source and sort it properly.
Ref:
http://msdn.microsoft.com/en-us/library/windows/apps/br211837.aspx
http://msdn.microsoft.com/en-us/library/windows/apps/br211792.aspx

GWT Horizontal panel with horizontal scrolling

Is there a way to get horizontal scrolling implemented in a horizontal panel ?
or any other panel can be used to achieve the functionality mentioned below -
The requirement is that i am creating a search bar where search items are being added as and when user inputs them (something similar to this - http://documentcloud.github.com/visualsearch/)
Well i got the functionality working and even the looks are similar but struggling on the horizontal panel. I am using a horizontal panel as a search bar and it has a suggest box embedded in it. so when user inputs data the search items are added to the horizontal panel. but as and when search items are added the horizontal panel grows in size and moves out of the screen and browser's horizontal scroll bar appears. But i wanted a scroll bar on the horizontal panel itself.
Can this be achieved ?
want some ideas ... any help is appreciated.
Thanks.
You may want to use the css overflow-x attribute. If you want it to scroll set the value to scroll or auto. If you need to constraint the size of the div in specific ways you may need to control it progamatically.
I don't see any other solution than place your HorizontalPanel inside a scroll panel.
Then I would add a CSS property to prevent the vertical scrollbar from showing.
Here's an ui.xml excerpt:
<ui:style>
.scrollHorizontal{
overflow-y: hidden !important;
/* !important used to force override the style "overflow:scroll"
of the ScrollPanel */
}
</ui:style>
<g:ScrollPanel addStyleNames="scrollHorizontal">
<g:HorizontalPanel ui:field="resultsPanel" />
</g:ScrollPanel>
You may need to check the client height of your scroll panel so as to adjust the height of the items inside the horizontal panel, depending on your layout.

How to create a custom listview like iPhone in Android

I was designing a custom listview in Android following the online tutorial Android Series: Custom ListView items and adapters and I created a custom list view like this:
This is simple and fine. Now I was surfing the web and found this fantastic listview for iPhone:
How can I create something like this? How has he given a box like interface for each row separating them from background and each other?
You could try removing the list dividers (android:divider="#null" or android:dividerHeight="0px") and using a custom drawable as the background for each row (either a 9patch or ShapeDrawable, possibly arranged in a StateList so they can have pressed/selected states). Then just also put a margin on the row layout, and your spacing should be taken care of (alternatively, you could use a transparent image as the list's divider with an appropriate height). But be careful about simply aping an iOS style because it looks nice; think about the typical Android user and what they take as interface cues. If you made your Android list look exactly like that screenshot below, I think many Android users wouldn't even realize they could click on those rows, or that they're part of a scrollable list.
The listview and each item in the listview can have separate backgrounds. So all you need to do is make some PNG files that look like the background of the items and the list itself.
You can set the backgrounds in XML using the android:src.
Or at runtime using:
setImageDrawable(getResources().getDrawable(R.drawable."picture name"))