6

Here's my switch in xml:

<Switch
    android:id="@+id/mySwitch"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:textOff="OFF"
    android:textOn="ON" />

I cannot find a property in <switch> to make the switch bigger, what I tried so far:

android-textSize, controls the description size that is located right next to the switch, not the switch ON/OFF itself

android:switchMinWidth, controls the width of each switch's component (ON/OFF)

I simply want my switch to be bigger, and the text ON and OFF also take effects of the switch getting bigger.

Is there a property I missed?

Hariharan
  • 3,191
  • 4
  • 19
  • 31
Hendra Anggrian
  • 5,780
  • 13
  • 57
  • 97
  • You mean the size in the layout? I might be missunderstanding your problem but don't you mean the stuff that `android:layout_width` and `android:layout_height` are responsible for? `wrap_content` tells the view to take the size that the content needs, if you want more try absolute values (e.g. *60dp*) or `match_parent` – avalancha Nov 05 '13 at 09:36
  • unfortunately changing layout_width and layout_height to match_parent only marks the area of the switch, the size of the switch itself remains unchanged. If I change both to match_parent, I will have a very small switch in the middle of the screen. – Hendra Anggrian Nov 05 '13 at 09:41
  • ahhh ok, thx for clearing that up, I was already wondering if you skipped some crucial part in the android tutorial :D – avalancha Nov 05 '13 at 09:49
  • Did you figure a way to do it? – A.J. Dec 31 '13 at 17:42

2 Answers2

17

Try this solution.

Add these lines to your tag in xml file.

android:scaleX="2"
android:scaleY="2"
Community
  • 1
  • 1
Gaurav
  • 1,965
  • 2
  • 16
  • 32
0

I think you need customize current switcher through replace image files in styles.

This link automatically generate needed files, after that you get your own image files, re-draw what you want if needed.

Liftoff
  • 24,717
  • 13
  • 66
  • 119
artemiygrn
  • 1,036
  • 7
  • 18