Progress bar display twice.
My XML code:
Style :
How do I solve this problem?
you can add gradient like
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="45"
android:endColor="#color/colorgreenheader"
android:centerColor="#color/color_neartowhite"
android:startColor="#color/color_grey_light" />
<corners android:radius="8sp" />
<size android:width="8sp"/>
<padding
android:left="0.5sp"
android:right="0.5sp" />
</shape>
Related
I tried changing scrollbar of GridView:
android:scrollbarThumbVertical="#drawable/scrollbar_vertical_thumb"
android:scrollbarTrackVertical="#drawable/scrollbar_vertical_track"
scrollbar_vertical_thumb.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="0"
android:endColor="#005A87"
android:startColor="#007AB8" />
<corners android:radius="6dp" />
</shape>
scrollbar_vertical_track.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient
android:angle="0"
android:endColor="#9BA3C5"
android:startColor="#8388A4" />
<corners android:radius="6dp" />
</shape>
But it's not working and gridview keeps showing original scrollbar.
please try
android:scrollbarAlwaysDrawVerticalTrack=true
android:scrollbars=vertical
if it didnt work then try android:scrollbarSize too
I want to create Check in Screen layout in android like this
please help me how can i create layout like this.
please somebody help me
First create two shapes, one for Default state of Button, second for pressed state:
default_shape.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners
android:radius="5dp"/>
<gradient
android:startColor="#ffd700"
android:endColor="#daa520"
android:angle="90"/>
</shape>
pressed_shape.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners
android:radius="5dp"/>
<gradient
android:startColor="#ffF8dc"
android:endColor="#daa520"
android:angle="90"/>
</shape>
then create a selector:
your_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#drawable/pressed_shape"
android:state_pressed="true" />
<item android:drawable="#drawable/default_shape"
android:state_pressed="false" />
<item android:drawable="#drawable/Default_shape" />
</selector>
and then give the selector to Your button as Background:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="#+id/your_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/your_selector" />
</LinearLayout>
You could Play a Little bit with the Colors from the shape...this is just an example how to do it...
Add given file in to drawable folder and make changes for background color. use this as background of your TextView.<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:endColor="#color/something"
android:centerColor="#color/something_else"
android:startColor="#color/something_else_still"
android:angle="270" />
<corners
android:radius="3dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
I'm trying to change the outlook of the scrollbar thumb for a ListView.
I added the following property to the listview:
android:scrollbarThumbVertical="#drawable/scrollbar_vertical_thumb"
scrollbar_vertical_thumb.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient android:angle="0" android:endColor="#FF9900" android:startColor="#FF9900"/>
<corners android:radius="1dp" />
<size android:width="3dp" />
</shape>
After applying my gradient I noticed I have tho scrollbars or scrollbar thumbs, as you can see in following picture (at the beginning of the page there's the left one and then it changes to the second one):
It seems like I didn't override the theme style for the scrollbar thumb.
Does anybody know, what could be wrong?
Update your ListView by adding 'scrollbarThumbVertical' property,
android:scrollbarThumbVertical="#drawable/scrollbar_vertical_thumb"
Then add following to 'scrollbar_vertical_thumb.xml' in drawable folder,
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<gradient android:angle="0" android:endColor="#6699FF" android:startColor="#3333FF" />
<corners android:radius="1dp" />
<size android:width="10dp" />
</shape>
You've override the wrong property.
You should do this instead:
<item name="android:fastScrollThumbDrawable">#drawable/scrollbar_vertical_thumb</item>
I'd like to have a background color of a RelativeLayout similar to that of an image shown in the link below. Ignore the black strip in the bottom half of the image.
I don't want to use the image as a background of the layout. Can you give me an idea of how to proceed?
You can use gradient. Set different gradient in selector as you want. Done!
GradientDrawable.class
This is what you want, set your colors. Enjoy!
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:bottom="30dp">
<shape android:shape="rectangle" >
<corners
android:topRightRadius="8dip"
android:topLeftRadius="8dip" />
<gradient
android:startColor="#030303"
android:endColor="#3B3B3B"
android:angle="270" />
</shape>
</item>
<item android:top="30dp" >
<shape android:shape="rectangle" >
<corners
android:bottomLeftRadius="8dip"
android:bottomRightRadius="8dip" />
<gradient
android:startColor="#4B5057"
android:endColor="#4B5059"
android:angle="270" />
<size android:height="30dp" />
</shape>
</item>
</layer-list>
just try with shape file structure. I think this may give the solution.
//save this below code as gradient and use as background of your layout as
android:background="#drawable/gradient"
//gradient.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#232323" android:endColor="#4B5059"
android:angle="270"/>
</shape>
I would like to change the background color of a SeekBar from yellow (default) to a color I choose but I've only found the method to change the color of the black area around the SeekBar. Can anyone help me????
xmls ( background_fill , progress_fill and progress could look like that for a gradient red
progress xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#android:id/background"
android:drawable="#drawable/background_fill" />
<item android:id="#android:id/progress">
<clip android:drawable="#drawable/progress_fill" />
</item>
</layer-list>
background_fill xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="#FF555555" android:centerColor="#FF555555"
android:endColor="#FF555555" android:angle="90" />
<corners android:radius="5px" />
<stroke android:width="2dp" android:color="#50999999" />
<stroke android:width="1dp" android:color="#70555555" />
</shape>
and progress_fill xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="#FF470000" android:centerColor="#FFB80000"
android:endColor="#FFFF4400" android:angle="180" />
<corners android:radius="5px" />
<stroke android:width="2dp" android:color="#50999999" />
<stroke android:width="1dp" android:color="#70555555" />
</shape>
i did not complete the implementing for android:thumb, so the thumb will be still the original one
Therefore we just have to delete this line again from our layout xml where we define the seekbar
android:thumb="#drawable/thumb"
for more info see this link