Radial SeekBar
Please help me to how to draw a Radial SeekBar, Plaese check the image url that is actual design of seek bar. I tried many ways but not worked out properly.
I tried like this
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
tools:context="com.scanner.com.protracterview.MainActivity">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0"
android:id="#+id/number"
android:textSize="18sp"
android:layout_marginBottom="30dp"
android:gravity="center"/>
<com.goodiebag.protractorview.ProtractorView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:arcColor="#91d8f7"
app:arcProgressColor="#91d8f7"
app:tickColor="#4a4a4a"
app:indicatorType="line"
app:tickProgressColor="#abe6"
app:textColor="#000"
app:textProgressColor="#FF0000"
app:angleTextSize="0dp"
app:arcWidth="2dp"
app:progressWidth="2dp"
app:tickOffset="18dp"
app:tickLength="0dp"
app:angle="15"
android:id="#+id/protrat"
app:tickIntervals="15"
app:ticksBetweenLabel="three"
app:touchInside="true"
app:roundEdges="true"
android:layout_below="#+id/number"
android:layout_alignParentEnd="true" />
If you want something like this -
Follow this - (Matt Joseph)
There is a class CircularSeekBar.java paste it in your project
attrs.xml (in res/values/attrs.xml)
and your xml file should be like this,
<mrbrown.arcseekbar.CircularSeekBar
android:id="#+id/circularSeekBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:start_angle="180"
app:end_angle="0"
app:circle_x_radius="500dp"
app:circle_y_radius="500dp"
app:use_custom_radii="true"
app:progress="0"
app:max="100"
app:pointer_alpha_ontouch="100"
app:pointer_color="#0174DF"
app:pointer_halo_color="#880174DF"/>
Related
I am making an application using Google maps. I am using AutoCompleteTextView to get suggestions of places. The output is as follows :
As you can see from the image, the border of the suggestion box is overlapping the TextView. I am using custom item layout with a Textview inside a Linear Layout.
<?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:background="#fff"
android:orientation="horizontal" >
<TextView
android:id="#+id/resultValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#fff"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:textColor="#474040"
android:textSize="15sp" />
</LinearLayout>
Is there a way to bring the suggestion window down and to remove or change the colour of the grayish border of the suggestion window ?
Was doing the same thing as in the accepted answer, but was still having the overlap issue. To fix that make this call:
autocompleteView.setDropDownVerticalOffset(0);
Try like this, android:popupBackground="#EFEEEC"// change according your border you want for the suggestion box
<AutoCompleteTextView
android:id="#+id/autocomplete"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/text_area"
android:inputType="text|textNoSuggestions|textMultiLine"
android:paddingLeft="10dp"
android:popupBackground="#EFEEEC"
android:textColor="#333333"
android:textColorHint="#9c9c9c"
android:textSize="18sp"
android:completionThreshold="1" />
and auto_textview.xml
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="12dp"
android:textColor="#333333"
android:layout_margin="15dp"
android:textSize="16sp" >
</TextView>
text_area9.png
Final output will look like
Hope this help you.
Use a custom drawable like
AutoCompleteTextView txtNames= (AutoCompleteTextView)findViewById(R.id.editBox);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.drawable.customlist, restList);
txtRestNames.setAdapter(adapter);
and add customlist as
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/cust_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dip"
android:textSize="12dp"
android:singleLine="false"/>
Change the parameters/color to suit your needs. Try it....hope it helps
When using a small gif to be used as a background tile for a layout, I have found that my buttons appear transparent which is NOT what I want and I have not set any transparency parameters either (unless the background gif is transparent?)
My XML is:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="2"
android:background="#drawable/backgroundrepeat"
>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:id="#+id/scrollview1"
android:layout_weight="2"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp">
<TextView
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:id="#+id/textview"
android:scrollbars="vertical"
android:textColor="#android:color/black"
/>
</ScrollView>
<Button android:text="Connect To Phidget" android:id="#+id/connect_button" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:enabled="false"
android:layout_weight="0"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#null"
></Button>
</LinearLayout>
And the drawable tile is:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="#drawable/original10"
android:tileMode="repeat"
/>
Can anyone help? Thanks
As per the Android developer documentation, it is quite clearly stated that using GIF images is discouraged.
While they don't elaborate on the reason - I'm assuming due to its multi-layering nature. But I've played with the GIF images and encountered unwanted errors similar to yours.
So I'd suggest you to export your GIF image to a PNG and try with that. You can use any tool like Gimp or IrfanViewer.
Ok. Than remove the tag:
android:background="#null"
That makes it transparent in the way you describe it.
add this tag in button
android:background="#android:drawable/btn_default"
I am a new comer in android. I've tried to make a layout like picture below but I can't make it.
That rectangle is an image and two others are text view. I've tried to make it but it always wrong. Looking forward to hearing from you guys, thanks for advance.
Define one layout as follows:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rlGridRow"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="#+id/imageView01"
android:layout_width="36.0dip"
android:layout_height="36.0dip"
android:scaleType="fitCenter"
android:layout_alignParentLeft="true" />
<TextView android:id="#+id/txtLink1"
android:paddingLeft="6.0dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FF00FF"
android:layout_toRightOf="#id/imageView01" />
<TextView android:id="#+id/txtLink2"
android:paddingLeft="6.0dip"
android:paddingBottom="8.0dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#00FFFF"
android:textSize="12sp"
android:layout_marginTop="-4.0dip" android:layout_toRightOf="#id/imageView01"
android:layout_below="#id/txtLink1" />
</RelativeLayout>
See this link for additional info.
This my current layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scrollview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#F5F5DC"
>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<RadioButton android:id="#+id/radio_red"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/flag_dk"
android:textColor="#000000"
android:layout_gravity="center_horizontal"
android:drawablePadding="10dip"
android:text="Danish" />
<RadioButton android:id="#+id/radio_blue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/flag_en"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dip"
android:drawablePadding="10dip"
android:textColor="#000000"
android:text="English" />
</RadioGroup>
</LinearLayout>
</ScrollView>
I get this:
I would like to have some space (margin) between radiobutton an the flag (it's drawable). Is it even possible?
You can do like the following:
<android.support.v7.widget.AppCompatRadioButton
android:layout_width="match_parent"
android:layout_height="#dimen/view_size"
android:button="#null"
android:drawablePadding="100dp"
android:drawableLeft="?android:attr/listChoiceIndicatorSingle"
android:text="label" />
In my case, where I have a custom drawable shape, adding android:paddingDrwable attribure did not work but adding android:paddingLeft="5dp" did.
Where you are setting the image and the text give blank spaces before it.
for example: radiobutton.setText(" "+Text);.You will see the desired output.
I don't think it is possible to add space between the image and the radio button using the android apis. However, the answer to your question I think is to add some space in the image itself.
Use Relative Layout instead of Linear Layout it gives android:layout_margingleft & android:layout_margingRight to drop your radio buton & Images as well.
Also give android:padding="10dip"
Try it it will definitely work!!!!
I'd like to use a 1x1 size Nine-patch image from Android drawable resources.
When I'm trying to display it with <ImageView> in my layout xml file, this one is never showing up on the Android emulator device. Here's the xml code below:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10px"
>
<RelativeLayout
android:gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="#+id/text_label"
android:text="#string/text"
android:textSize="10pt"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<CheckBox android:id="#+id/my_checkBox"
android:layout_alignBaseline="#id/text_label"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
<ImageView android:paddingTop="10px"
android:paddingBottom="10px"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="#android:drawable/divider_horizontal_bright" />
</LinearLayout>
I tried another one with the same size and I have the same problem it's still blank.
My research on Google was irrelevant. Hope you can find what am I doing wrong here.
Thanks in advance for your help.
Lorenth
What version of the SDK are you writing for?
Take a peek at the divider_horizontal_bright.png files in the different versions :)
It's 99% transparent in 8, but like 50% transparent light grey in 4.
Or, Perhaps you meant divider_horizontal_bright_opaque?
This works for me:
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#android:drawable/divider_horizontal_dark"
android:scaleType="fitXY"
/>