Smaller ratings bar - android

I've been through all of these forums looking for an answers on how to change the size of the ratings bar (making the stars smaller) and im not really sure if it can be done? I saw the tutorial with the "custom pretty ratings bar" but i'm not really trying to create anything new. I want to use the stars that the packages come with. I want a 10 star rating where all stars fit on the screen, right now only about 7 fit on the screen. Basically I want it to look like the IMDB app. rating system if anyone has seen that? Thanks for the help. I'll paste some code but it's not a lot.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RatingBar
android:id="#+id/ratingBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="10" />
</LinearLayout>

I think the only way is to make your own custom star drawables. Even if they are just copies of the system star drawable that are shrunk down.

You just have to create your custom style for the rating bar.
Here it is well explained:
https://stackoverflow.com/a/5800686/435855

Related

Is it possible to disapper the border of image button at particlualr selected areas in android?

I am trying to set a border for few of the image buttons for a particular screen layout in android. But for some buttons, I want to disable the border if the screen-layout background is blue colour. Please help me how to do this?
(I assume you design your app with Material Theme)
I think you can't do it (maybe possible with some hacky technique), because it's not intended to be that way.
Google has designed each view to underline each of their own purposes. So, I believe, If you can modify a button that way, it won't felt like a button to users thus can raise some misunderstanding.
What possibly user think if such button that doesn't have default blue, exist? Do they still think that as a Button?
Personally, I suggest that you leave the border as-is, if you still intended to make it feels like a Button.
Otherwise, if you really need it, you can always use CardView, put an ImageView inside it and attach OnClickListener to it. I think the result is quite similar because almost every rectangular view Google has nowadays, got similar visual to CardView.
Btw, I made this in my recent project to achieve a borderless Button-ey Image. Maybe it'll help.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
card_view:cardElevation="4dp"
card_view:cardUseCompatPadding="true"
card_view:contentPadding="0dp">
<ImageView
android:id="#+id/clickable_photo_thumbnail_image_view"
android:layout_width="#dimen/photo_thumbnail_size"
android:layout_height="#dimen/photo_thumbnail_size"
android:adjustViewBounds="true"
android:scaleType="centerCrop" />
</android.support.v7.widget.CardView>
(UPDATE) This is the screenshot from my app, produced with above code:
(In my screenshot, I already use a RecyclerView)

Arrows for list view in Android

Is there any way where I can have default arrows in a list view,without reading them as an array from the xml? If I use ImageViews for arrows,then they might become really ugly. I am bad in graphic design.
Thank you.
EDIT
I found this site that could be useful to many people.
material design icons
You can always use this Unicode codes to draw arrows as text (if that is what you want)
U+2192 →
U+25B6 ▶
U+2794 ➔
More codes here: http://unicode-table.com/en/sets/arrows-symbols/
You can use custom layout to make the arrow as a part of the background of the list view row, look here
you will be able to do something like this:
Just follow the instructions
If you are bad at graphic design you can use free resources from net instead.
Here you have the Google free icon resources you can use with material style where you can find some arrows
Google icon pack
Look at this for android icons for different uses https://romannurik.github.io/AndroidAssetStudio/. You can use it for your list item row. If you want arrow like ios then create row ui and take imageview for arrow.
Row XML :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/tvText"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Your Text"/>
<ImageView
android:id="#+id/ivArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="#drawable/arrow" >
</ImageView>
</RelativeLayout>

Difference for Widget.ProgressBar.Small and Widget.ProgressBar.Small.Inverse

I try out two different progress bar styles for action bar button, through
refreshMenuItem.setActionView(R.layout.actionbar_indeterminate_progress);
actionbar_indeterminate_progress.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?attr/actionButtonStyle" >
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="#android:style/Widget.ProgressBar.Small" />
</LinearLayout>
I had tried Widget.ProgressBar.Small and Widget.ProgressBar.Small.Inverse. However, I do not see any visual difference.
Widget.ProgressBar.Small
Widget.ProgressBar.Small.Inverse
I expect there is an inverse in color but there isn't. Am I missing something?
There is a slight difference, but it's difficult to notice at first.
The Widget.ProgressBar.Small style version is intended to be placed over dark backgrounds while the Widget.ProgressBar.Small.Inverse style version is intended to be placed over light backgrounds.
Normally you would probably not notice this. The best way to check it is to put the combinations of the two progress bars on black and white backgrounds and display it a on good display, then you can notice differences on the edges.

Re-creating Google+ app's UI

I'm fairly new to Android development and planning to build a simple news reader app to further familiarize myself to the platform.
The problem is; I want each of the news-item to look like Google+'s post item below:
Well, basically a big headline picture with a title and some description underneath.
I tried to re-create it using a Button (because the whole thing needs to be clickable by the user) while setting a drawable at the top of the text. It worked quite nicely.. until I decided to add more drawables to it:
Here's my XML code (although I doubt anyone would need it):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_launcher"
android:drawablePadding="8dp"
android:drawableTop="#drawable/temp_jakarta"
android:text="Button" />
</RelativeLayout>
Can you tell me why is this happening or maybe, suggest me another way to accomplish this?
Thanks in advance!
p.s., I'm pretty sorry about the link; as a new user, SO didn't allow me to post images just yet. :(
Put everything inside a RelativeLayout and place one relative to others (event on top, this doesn't matter at all) using the layout_below/above/left_of/right_of/... etc.
See http://developer.android.com/guide/topics/ui/layout/relative.html for usage, http://developer.android.com/reference/android/widget/RelativeLayout.html for a complete reference of the RelativeLayout class and "Android Layout Tricks" series in the Developer Blog for some tips_
http://android-developers.blogspot.com.es/2009/02/android-layout-tricks-1.html
http://android-developers.blogspot.com.es/2009/02/android-layout-tricks-2-reusing-layouts.html
http://android-developers.blogspot.com.es/2009/03/android-layout-tricks-3-optimize-with.html

Android -- How to remove that little extra padding when using a ListView with custom background?

I have the following layout:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#EAEAEA">
<ListView
android:id="#+id/xxx"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="#464C59"
android:divider="#A4C539"
android:dividerHeight="1px">
</ListView>
<ImageView
android:id="#+id/home_bottom_bar"
android:src="#drawable/bottombar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:clickable="true"/>
</FrameLayout>
The goal is to have some sort of advertising bar at the bottom of the activity (which contains a list of items). It works ok, except for one thing! There is some sort of extra space just under the bar (it's very small but it's noticeable enough). By the way, all the paddings are set to 0 so where does this space come from?
Thanks!
EDIT
After investigating the issue, it turns out that the custom background (#EAEAEA) is causing this extra space. Still don't know how to fix this though.
When you mention that it is a small extra space, it may be the tiny gradient at the top and bottom. Created by ListView, when it is made scrollable.
You may read about ListView Backgrounds, this should give you the idea on how to fix it, if it is caused by this special gradient.
This gradient line can apparently also be removed: extra line in tab host
You may want to use the merge tag since every activitys base layout is a FrameLayout.
(This may cause the padding. Im not 100% sure on this one though)
Look here.

Categories

Resources