Does anyone know the code for centering the clock
i am trying to edit statusbar.xml in the layout folder of SystemUI.apk , but I get is a blank black status bar
please help
You can find it in the gingeritis Rom
I think he wants help on how to do it on the rom he's using. but yes gingeritis has this. You may want ask chingy on his forums or on rootzwiki to see if he could give you any advice
Sent from my HTC Mecha using Tapatalk
It is also optional in Eternity through the tweaks. So might hit up that group or just look at how their status bar is setup.
Sent from my HTC Mecha using xda premium
I think the centered clock is cool sometimes but I noticed that notification texts sometimes overlap the centered clock or if you have too many notifications, it makes the status bar look all crammed together
this Thunderbolt has been Infected with a Virus for all Eternity
xXJay_RXx said:
I think the centered clock is cool sometimes but I noticed that notification texts sometimes overlap the centered clock or if you have too many notifications, it makes the status bar look all crammed together
this Thunderbolt has been Infected with a Virus for all Eternity
Click to expand...
Click to collapse
yeah it does on eternity, however i think I can make it go away when a notification comes in
I have the code now, i am just having problems getting my SystemUI.apk to recompile
have you tried using the UOT kitchen and then extracting the SystemUI.apk from the build they give you? atleast you'll know its a modded version of the SystemUI.apk file you got from your own rom.
i took a look at virus' statusbar.xml and i think he is referencing other files for the clock location. probably because of his tweak options.
i will try out UOT
edit: tried out UOT. its not going to do what i am looking for. thanks for the idea though
This is something I've been working on for the past couple of days. And while I've successfully moved the clock to the center of the statusbar, I didn't like the notifications overlapping on the clock.
To try to avoid this, I changed the androidaddingRight value from 10.0dip to 180.0dip. This made it so that the notification text would stop just shy of the clock in portrait mode, but when receiving a notification while in landscape mode (ie. an sms notification), the text would overlap the clock since the 180dip padding wasn't enough to push the text to the left of the clock with the added screen width pixel count that results from being in Landscape mode.
Thus began my searching for alternative methods of setting up the layout of the "tickerView" which is what controls the text layout for notifications.
The only thing I could come up with that would always keep the incoming notification text from overlapping the clock would be to use a RelativeLayout string rather than LinearLayout and use the android:layout_toLeftof format, while using the clock as the id. Or in other words, android:layout_toLeftof="@+id/clock". But inserting that into the XML on the tickerView line was causing a compilation error reporting that the compiler couldn't find the resource for the clock id.
I'm not familiar enough with XML editing to figure out how to remedy this, so I have practically given up at this point and have resorted to allowing notifications to overlap the clock when in Landscape mode, but they are fine (no overlapping) in Portrait mode by using the aforementioned 180dip padding.
If anyone has any ideas on how to add the necessary resources to allow the compiler to recognize the clock id, hit me up and we'll see what we can accomplish.
Boostjunky said:
This is something I've been working on for the past couple of days. And while I've successfully moved the clock to the center of the statusbar, I didn't like the notifications overlapping on the clock.
To try to avoid this, I changed the androidaddingRight value from 10.0dip to 180.0dip. This made it so that the notification text would stop just shy of the clock in portrait mode, but when receiving a notification while in landscape mode (ie. an sms notification), the text would overlap the clock since the 180dip padding wasn't enough to push the text to the left of the clock with the added screen width pixel count that results from being in Landscape mode.
Thus began my searching for alternative methods of setting up the layout of the "tickerView" which is what controls the text layout for notifications.
The only thing I could come up with that would always keep the incoming notification text from overlapping the clock would be to use a RelativeLayout string rather than LinearLayout and use the android:layout_toLeftof format, while using the clock as the id. Or in other words, android:layout_toLeftof="@+id/clock". But inserting that into the XML on the tickerView line was causing a compilation error reporting that the compiler couldn't find the resource for the clock id.
I'm not familiar enough with XML editing to figure out how to remedy this, so I have practically given up at this point and have resorted to allowing notifications to overlap the clock when in Landscape mode, but they are fine (no overlapping) in Portrait mode by using the aforementioned 180dip padding.
If anyone has any ideas on how to add the necessary resources to allow the compiler to recognize the clock id, hit me up and we'll see what we can accomplish.
Click to expand...
Click to collapse
can you attach your systemUI.apk?
racinwarrior said:
can you attach your systemUI.apk?
Click to expand...
Click to collapse
You mean the one I have settled on (where it's fine in portrait mode, but overlaps in landscape)? Or one of the 30 or so experimental/failed attempts?
Sent from my ADR6400L using XDA App
Boostjunky said:
You mean the one I have settled on (where it's fine in portrait mode, but overlaps in landscape)? Or one of the 30 or so experimental/failed attempts?
Sent from my ADR6400L using XDA App
Click to expand...
Click to collapse
the one you settled on. I don't use my phone in landscape and I want to see how you did the clock in xml
racinwarrior said:
the one you settled on. I don't use my phone in landscape and I want to see how you did the clock in xml
Click to expand...
Click to collapse
How about I just paste the status_bar XML?
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<com.android.systemui.statusbar.StatusBarView android:orientation="vertical" android:background="@drawable/statusbar_background" android:focusable="true" android:descendantFocusability="afterDescendants"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="horizontal" android:id="@id/icons" android:layout_width="fill_parent" android:layout_height="fill_parent">
<com.android.systemui.statusbar.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:paddingLeft="6.0dip" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" android:layout_alignParentLeft="true">
<TextView android:textColor="#ffffffff" android:id="@id/plmnLabel" android:paddingTop="3.0sp" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
</com.android.systemui.statusbar.IconMerger>
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:paddingRight="6.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentRight="true" />
<com.android.systemui.statusbar.BatteryText android:textAppearance="@android:style/TextAppearance.StatusBar.Icon" android:gravity="center_vertical" android:orientation="horizontal" android:paddingRight="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" />
</LinearLayout>
<LinearLayout android:gravity="center" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent">
<com.android.systemui.statusbar.Clock android:textAppearance="@android:style/TextAppearance.StatusBar.Icon" android:textSize="16.0sp" android:gravity="center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
</LinearLayout>
<LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:paddingLeft="6.0dip" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageSwitcher android:id="@id/tickerIcon" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginRight="8.0dip">
<com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" />
<com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" />
</ImageSwitcher>
<com.android.systemui.statusbar.TickerView android:layout_gravity="center_vertical" android:id="@id/tickerText" android:paddingRight="180.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0">
<TextView android:textAppearance="@android:style/TextAppearance.StatusBar.Ticker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" />
<TextView android:textAppearance="@android:style/TextAppearance.StatusBar.Ticker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" />
</com.android.systemui.statusbar.TickerView>
</LinearLayout>
<com.android.systemui.statusbar.DateView android:textAppearance="@android:style/TextAppearance.StatusBar.Icon" android:textSize="16.0sp" android:gravity="left|center" android:id="@id/date" android:background="@drawable/statusbar_background" android:paddingLeft="6.0px" android:paddingRight="6.0px" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
</com.android.systemui.statusbar.StatusBarView>
Boostjunky said:
How about I just paste the status_bar XML?
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<com.android.systemui.statusbar.StatusBarView android:orientation="vertical" android:background="@drawable/statusbar_background" android:focusable="true" android:descendantFocusability="afterDescendants"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="horizontal" android:id="@id/icons" android:layout_width="fill_parent" android:layout_height="fill_parent">
<com.android.systemui.statusbar.IconMerger android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/notificationIcons" android:paddingLeft="6.0dip" android:layout_width="0.0dip" android:layout_height="fill_parent" android:layout_weight="1.0" android:layout_alignParentLeft="true">
<TextView android:textColor="#ffffffff" android:id="@id/plmnLabel" android:paddingTop="3.0sp" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
</com.android.systemui.statusbar.IconMerger>
<LinearLayout android:gravity="center_vertical" android:orientation="horizontal" android:id="@id/statusIcons" android:paddingRight="6.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_alignParentRight="true" />
<com.android.systemui.statusbar.BatteryText android:textAppearance="@android:style/TextAppearance.StatusBar.Icon" android:gravity="center_vertical" android:orientation="horizontal" android:paddingRight="2.0dip" android:layout_width="wrap_content" android:layout_height="fill_parent" />
</LinearLayout>
<LinearLayout android:gravity="center" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent">
<com.android.systemui.statusbar.Clock android:textAppearance="@android:style/TextAppearance.StatusBar.Icon" android:textSize="16.0sp" android:gravity="center" android:id="@id/clock" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
</LinearLayout>
<LinearLayout android:orientation="horizontal" android:id="@id/ticker" android:paddingLeft="6.0dip" android:animationCache="false" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageSwitcher android:id="@id/tickerIcon" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginRight="8.0dip">
<com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" />
<com.android.systemui.statusbar.AnimatedImageView android:layout_width="@dimen/status_bar_icon_size" android:layout_height="@dimen/status_bar_icon_size" />
</ImageSwitcher>
<com.android.systemui.statusbar.TickerView android:layout_gravity="center_vertical" android:id="@id/tickerText" android:paddingRight="180.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_weight="1.0">
<TextView android:textAppearance="@android:style/TextAppearance.StatusBar.Ticker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" />
<TextView android:textAppearance="@android:style/TextAppearance.StatusBar.Ticker" android:layout_width="fill_parent" android:layout_height="wrap_content" android:singleLine="true" />
</com.android.systemui.statusbar.TickerView>
</LinearLayout>
<com.android.systemui.statusbar.DateView android:textAppearance="@android:style/TextAppearance.StatusBar.Icon" android:textSize="16.0sp" android:gravity="left|center" android:id="@id/date" android:background="@drawable/statusbar_background" android:paddingLeft="6.0px" android:paddingRight="6.0px" android:layout_width="wrap_content" android:layout_height="fill_parent" android:singleLine="true" />
</com.android.systemui.statusbar.StatusBarView>
Click to expand...
Click to collapse
is there any way you can help me bro?
every time i try to recompile systemui.apk using apk manager, i delete the files ihave modified in the keep folder but when it compiles, the files i deleted never get put back in.
how are you decompiling/recompiling your apk?
racinwarrior said:
is there any way you can help me bro?
every time i try to recompile systemui.apk using apk manager, i delete the files ihave modified in the keep folder but when it compiles, the files i deleted never get put back in.
how are you decompiling/recompiling your apk?
Click to expand...
Click to collapse
You must be getting an error with apkmanager. This happens when there is something wrong with the edits you've made, whether they be XML or .9.PNG (nine patch images) files.
Try this. Delete the contents from your project folder (or rename the project if you have things you need to keep for reference). Then, decompile SystemUI, and without changing anything at all, immediately try recompiling it. If it compiles without any errors, then the problem lies with the edits you've been making.
If it still doesn't compile properly without touching anything, then either the SYSTEMUI has something wrong with it to begin with (such as a bad nine patch image), or it has dependencies, or your apkmanager is broken.
Sent from my ADR6400L using XDA App
I get an error when compiling, but it does compile and install on the phone correctly.
I took the text from your xml file, put it in my statusbar file, and when I recompile
I choose yes for a system apk, then choose yes to copy over all files I did not modify. I then delete all the files I have modified from the keep folder as well as the resources file. when I compile the apk and take a look inside it, the files I deleted do not get put back in the apk
do you mind sending me your systemUI.apk or your compiled statusbar.xml?
I have been trying to get this to work for two days and I am done trying
racinwarrior said:
do you mind sending me your systemUI.apk or your compiled statusbar.xml?
I have been trying to get this to work for two days and I am done trying
Click to expand...
Click to collapse
I can send you the status_bar.xml when I get to a computer. Just out of curiosity, are you attempting to change anything besides the status_bar.xml?
Sent from my ADR6400L using XDA App
Boostjunky said:
I can send you the status_bar.xml when I get to a computer. Just out of curiosity, are you attempting to change anything besides the status_bar.xml?
Sent from my ADR6400L using XDA App
Click to expand...
Click to collapse
Nope. I am just trying to move the clock.
Is there a way to manually compile systemUI using another program? I just dont understand why when i delete the files I modified from the "keep" folder as directed by apk manager, the one i modified do not get put in their place.
It works fine if i dont change anything because nothing needs to be deleted from the keep folder.
i am obviously doing something wrong as i am pretty sure it works fine for others
racinwarrior said:
Nope. I am just trying to move the clock.
Is there a way to manually compile systemUI using another program? I just dont understand why when i delete the files I modified from the "keep" folder as directed by apk manager, the one i modified do not get put in their place.
It works fine if i dont change anything because nothing needs to be deleted from the keep folder.
i am obviously doing something wrong as i am pretty sure it works fine for others
Click to expand...
Click to collapse
Yeah, the only time things get left out after compiling an apk with apkmanager is when you get an error message telling you to check the log using option 21.
And the only time you get that error message is when apkmanager detects a problem with the edits you've made.
My guess is that you're missing a simple character somewhere in the edits you're making to the xml file.
Or... What program are you using to make the edits to the xml files?
Sent from my ADR6400L using XDA App
Hi!
I am a beginner, so ease on me. i swear to god that I did search to find the answer myself and failed
I've build a gui that has 3 fragment, wrapped by scroll view. I need that each time only 2 fragment can be viewed. 1.How do I set the size of the fragment's that 2 fragments fits the whole screen, regardless of screen size?
TX
Tally
Android: layout ="wrap_content"
It's better to www.stackoverflow.com
Xperian8~ click thanks if it helps...
???????????
Sorry, not clear at all.
Which part should wrap content?
The fragment? The scrollView?
How could this help, I have 3 fragments that each 2 should match the screen.
Please try not to be so laconic.
Tally
The fragment and scroll view...it's t that k?
Xperian8~ click thanks if it helps...
??????????????
T? k? what?
shyamjptpm said:
Android: layout ="wrap_content"
It's better to www.stackoverflow.com
Xperian8~ click thanks if it helps...
Click to expand...
Click to collapse
shyamjptpm said:
The fragment and scroll view...it's t that k?
Xperian8~ click thanks if it helps...
Click to expand...
Click to collapse
Do you even know what you are talking about?
talybh said:
Sorry, not clear at all.
Which part should wrap content?
The fragment? The scrollView?
How could this help, I have 3 fragments that each 2 should match the screen.
Please try not to be so laconic.
Tally
Click to expand...
Click to collapse
Can you show some code?
Filling the screen at the same could probably be achieved by expanding the parent (i.e. your scrollview) to fit the whole screen and have you children (fragments) occupy the parents space in same parts by supplying a 'weight' attribute.
Tx, but then all 3 fragment would be visible at once won't they?
I need 2 fragment visible and swipe to the second and third.like a list, but horizontal.
main:
Code:
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android=""
android:id="@+id/HorizontalScrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<fragment
android:id="@+id/fragment1"
android:name=frag1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<fragment
android:id="@+id/fragment2"
android:name="frag2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<fragment
android:id="@+id/fragment3"
android:name="frag3"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
</LinearLayout>
</HorizontalScrollView>
one of the fragment (they are similar only different widgets)
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:progressDrawable="@color/green" android:scrollbarSize="3dp" android:layout_marginLeft="20dp" android:layout_marginRight="20dp" android:layout_marginTop="20dp" android:progress="40" android:max="100" android:background="@layout/button_shape"/>
<Button
android:id="@+id/button1"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="20dp"
android:background="@layout/button_shape"
android:text="@string/ButtonString"
android:textSize="13dp" />
<ImageView
android:id="@+id/Addhere"
android:layout_width="match_parent"
android:layout_height="140dp"
android:src="@raw/add" android:padding="20dp"/>
</LinearLayout>
So like two stacks of paper next to each other moving a paper from one stack to the other?
You could probably make a gesture listener and move the fragment, i will think about it a bit.
like a list
1.column 1 to the left column 2 to the right.
swipe
2. column 2 to the left column 3 to the right
1|2 ---swipe--> 2|3
I've implemented it with ScrollView, It works, just that I can't seem to fit the fragments regardless of screen size.
Hi Guys, I'm a n00b in APK modding so, after searching some infos here in XDA, I haven't found a way to do a little statusbar mod.
I would add to my statusbar two buttons, next to the carrier name, to reach "Settings Menu" and "Recents Apps" like ICS.
There is already the "Canc" button for notifications delete and I would replay this style for the new button; I attach here a jpegs that shows the way I would have the new buttons, obviously with different text ("Set's" and "App's").
The first thing to do I think is creating the two buttons in the carrier label; my res/layout/status_bar_expanded.xml shows this bit of code:
<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.ExpandedView androidrientation="vertical" android:focusable="true" android:descendantFocusability="afterDescendants"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout androidrientation="horizontal" android:background="@drawable/title_bar_portrait" androidaddingTop="3.0dip" androidaddingRight="3.0dip" androidaddingBottom="5.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content">
<com.android.systemui.statusbar.CarrierLabel android:textAppearance="?android:textAppearanceLarge" android:textColor="#ffdfdfdf" android:layout_gravity="center_vertical" androidaddingLeft="4.0dip" androidaddingBottom="1.0dip" android:layout_width="0.0dip" android:layout_height="wrap_content" android:layout_marginLeft="5.0dip" android:layout_marginTop="1.0dip" android:layout_weight="1.0" />
<TextView android:textSize="14.0sp" android:textColor="#ff000000" android:layout_gravity="center_vertical" android:id="@id/clear_all_button" android:background="@*android:drawable/btn_default_small" androidaddingLeft="15.0dip" androidaddingRight="15.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="4.0dip" android:layout_marginBottom="1.0dip" android:text="@string/status_bar_clear_all_button" style="?android:attr/buttonStyle" />
</LinearLayout>
Click to expand...
Click to collapse
I see in the red string the "Canc" button generation, what do I have to write before </LinearLayout> to add two other buttons next to it?
Next, how can I link these buttons to the related apps?
Many thanks to you guys!!!!
Hi,
I want to display 2 videos each taking half the screen vertically, I put them in a ScrollView in order to show only part of each video. I put both ScrollViews inside a FrameLayout. The problem is that the top VideoView inside the top ScrollView overlaps the bottom VideoView inside the other ScrollView. While if I use anything other than a VideoView on the bottom (A button or a Text Field for example) the top VideoView doesn't Overlap it. I tried to use a LinearLayout instead of a ScrollView in the bottom, but the result was the same.
here is my xml file :
Code:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.compname.appname.Activity2" >
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="160dp"
android:fillViewport="true" >
<VideoView
android:id="@+id/videoView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="160dp"
android:background="#BF1"
android:orientation="vertical"
android:layout_gravity="bottom" >
<VideoView
android:id="@+id/videoView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Any idea what I'm doing wrong here?
All help is appreciated.
Hi, I'm using android 4.2.2 and I'd like to build a power control widget/toggle for my app (example of power control widgets/toggles: https://developer.android.com/design/media/widgets_control.png).
I'm experiencing a lot of difficulties in achieving this task. Debugging this stuff is hard, also reading android developer official documentation and online resources, especially due to the lack of specific examples and tutorial related to this type of objects.
My power control widget/toggle should be composed as following:
- a button as big as around the widget size. Button must be resizable and dark gray;
- a icon with with transparent/alpha background. The icon should not be resizable and it must be centered inside the button;
- a stripe placed at the bottom of button, without margins. The stripe must be light gray and resizable only horizontally (it should always have a thickness of 4dp).
I've tried several methods (for example: relativelayouts, linearlayouts, imagebutton ...), made many checks with test widgets but each method I've tried has always shown new issues and it has not proven effective in order to complete the task (for example: issues about adjusting objects' dimensions and their mutual positions, issues with some objects not displaying theirself, issues with margins and paddings, ...).
This is my current widget.xml:
Code:
<?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"
android:layout_margin="10.0dp">
<ImageButton
android:id="@+id/widget_button"
android:background="@drawable/rounded"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:src="@drawable/ic_usb_test"
android:tint="#ff777777" />
<ImageView
android:id="@+id/widget_bottom"
android:background="@drawable/roundedlightgrey"
android:gravity="end"
android:layout_width="match_parent"
android:layout_height="4.0dp" />
</LinearLayout>
Exactly, how should I change properties in order to get a really working power control widget/toggle? Any ideas?
Solved
I've found a way to make things happen. Thanks to a irc user, I've, respectively, changed and added android:layout_height and android:layout_weight attributes to ImageButton object.
Then, I've adjusted the size of the widget dividing android:layout_margin attribute on all four sides (bottom, left, right, right, top).
Finally, I've set the icon, removing the tint too.
Here is the layout that helped me getting widget as in attached screenshot:
Code:
<?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"
android:layout_marginBottom="10.0dp"
android:layout_marginLeft="12.5dp"
android:layout_marginRight="12.5dp"
android:layout_marginTop="10.0dp">
<ImageButton
android:id="@+id/widget_button"
android:background="@drawable/rounded"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="center"
android:src="@drawable/ic_slide_switch_off" />
<ImageView
android:id="@+id/widget_bottom"
android:background="@drawable/roundedlightgrey"
android:gravity="end"
android:layout_width="match_parent"
android:layout_height="4.0dp" />
</LinearLayout>