Changing the style of a progressbar - android

I have loaded a progressBar from:
<?xml version="1.0" encoding="utf-8"?>
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+android:id/progress_small" style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
On different devices I get different visualization. I want the progressbar on every device and every android version look rounded and not being built by some short liney only.
Is there a way to force this?
Thanks so far

You need to create a custom ProgressBar. Check out previous questions.
Also check this examples here, here.
This example is without coding: http://majaxandroidtips.blogspot.com/2009/06/how-to-create-custom-progress-bar.html

There is no need to create custom progress bar,
I created a sample project to demonstrate how to skin the Progress bar.
Please take a look at it/
https://github.com/gansBhat/AndroidProjects/tree/master/Examples/CustomThinProgressBar
Same has been uploaded to google drive
https://drive.google.com/folderview?id=0BxHClVwHSqq5dVRvT1Qyd0hYN0k&usp=sharing
Let me know if you face some issue.

Related

No Android status bar with relativeLayout

I am developing an app with Android Studio 2.2.3 and I'm facing a problem I did not find before: if I add an Activity from a template such as Basic Activity, the newly created activity will let the device status bar display
If I add instead an activity from the Empty Activity template, no status bar shows up any more.
Reading through the layout files, I see that the Basic activity uses a android.support.design.widget.CoordinatorLayout whereas the Empty Activity uses a RelativeLayout. I cannot find any other differences, neither in the manifest. I programmed some apps with Eclipse some time ago and the status bar was there, even with the RelativeLayout, as far as I remember.
Any suggestion?
Thanks in advance, regards
Edit:
Status bar does not relate with layout. It is about the theme defined in the styles.xml. Can you check which theme is applied your activity?
Thanks steve for your suggestion: the behavior is due to
Yet another question: keeping this no-actionbar theme, why is my textbox not aligned with the top of the screen, like this:
My activity layout is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main4"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="it.pgsoftware.firebasepublisher.Main4Activity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test string"
android:layout_alignParentTop="true"
android:layout_marginTop="0dp"/>
</RelativeLayout>
and with the Layout inspector I get the following UI structure:
The LinearLayout at the top has a 72dp top-padding which I can't find digging into the themes: any suggestion?
Thanks in advance, regards
Please check the android:appTheme="#style/AppTheme" option in the manifest file . Check the theme option in res>style.xml file . Copy the stylesheet and paste in comment to see.

Smaller ratings bar

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

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

ActionBarSherlock + Google Maps API, Failed to find style 'mapViewStyle' in current theme

First of all, I know there are thousens of post asking the same, but after few days looking for a valid answer and try everything I'm still having the same problem...
So let's expose my situation:
I'm using ABS + google maps, so my map view xml is the following:
<?xml version="1.0" encoding="utf-8"?>
<com.actionbarsherlock.internal.view.menu.ActionMenuItemView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ViewContainer"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.google.android.maps.MapView
android:id="#+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0PGmnrCR70lothfjc_sFGTdFtESQPOksYKQWYpw"
android:clickable="true" />
</com.actionbarsherlock.internal.view.menu.ActionMenuItemView>
Few days ago everything was good, I was able to do my stuff in the app and everything. But suddenly I just made a little change, insert a framelayout to display more options in the screen. I tried to go back but was impossible...
I'm really deseparated, what can I do? maybe I can create a new project and paste all my code, but not really sure if it's going to work...
Any suggestions?
BTW my error code is this one
Missing styles. Is the correct theme chosen for this layout?
Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.
Failed to find style 'mapViewStyle' in current theme
java.lang.NullPointerException
Exception details are logged in Window > Show View > Error Log
Thank you for your time!
I finally solve the problem, the error in the screen is still there, but just like a warining and when I execute the app same to work fine.
The only think I made, is change the specific layout of ABS and put a frame layout.

Custom dialog with the look and feel of a default one - is it possible?

For clarification: I want all the custom dialogs to look like system default dialogs: for example, when user is using htc sense, the dialog should match htc sense dialog style, when user is using samsung with official customasation, the dialog should look like it. I want to go as native as possible. I am familiar that there are possibilities to modify the dialog, but I'm looking for a way to reference to the style the system uses and create a dialog with that.
What I have:
What I would like to achieve:
Code for my dialog layout which I invoke with dialog.setContentView(...):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="#android:style/Theme.Dialog"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="#+id/listView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip" >
</ListView>
</LinearLayout>
As you can see setting the style="#android:style/Theme.Dialog isn't helping. Any ideas what might be helping?
(I am familiar that there is already such a question: https://stackoverflow.com/questions/6746535/android-custom-dialog-but-with-look-and-feel-of-default-one but there isn't an accepted answer)
If you want the dialog that appear just for your application purpose then follow this:
See this image i have create this one to save Image or Post it to different way.
I have created the xml layout as per my requirement. If you want to add the list view as you have explained in to the question then you have to manualy implement that behaviour in the content of the dialog. Means for such layour You have to implement the Custom ListView that have that radio button and text. And also have some Java code to do action according to that selection.
With that you can acheive as you want.
Enjoy. :)
You can build a native-look like dialog for one UI, but when another user has some other ROM/modified UI, then the dialog doesn't look like a native one to hem/her. There isn't a built in functionality, to access system dialog resources and populate all dialogs from native layouts only.

Categories

Resources