android


Android withText option does not work for action bar buttons on Huawei MediaPad (T1-A21L)


The buttons on the action bar on this tablet, if shown with text, suffer from text warping as in the screenshot below:
I tried many possible settings combinations (ifRoom, always, withText,...). Even attempting to manipulate the actual view of the button get me nowhere (or maybe I didn't persevere enough). Setting the widths of the TextView and the parent LinearLayout had no effect unless they're fixed numbers.
Any ideas?
EDIT:
I neglected to mention that attempting to use an icon along with text only shows the icon. This is using the native action bar. Below is the xml of the action button above:
<item
android:id="#+id/itemConfig"
android:showAsAction="ifRoom|withText"
android:title="Network Config"
android:visible="true"/>
Setting the menu item in the following manner:
<item
android:id="#+id/itemConfig"
android:icon="#drawable/ic_action_networkconfig"
android:showAsAction="ifRoom|withText"
android:title="#string/network_config"
android:visible="true"/>
causes this
So in essence, the tablet doesn't like text in its action bar. Any clues?
It looks like your menu code is correct. For reference check my menu item xml:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="#+id/itemConfig"
android:icon="#drawable/icon"
app:showAsAction="withText|always"
android:title="#string/network_config"/>
</menu>
Device will show text with icon only if we have space. You can check with landscape mode. Here is the example
Source:
http://developer.android.com/guide/topics/ui/actionbar.html#ActionItems
If your menu item supplies both a title and an icon—with the title and icon attributes—then the action item shows only the icon by default.
If you want to display the text title, add "withText" to the showAsAction attribute.
Note: The "withText" value is a hint to the action bar that the text title should appear. The action bar will show the title when possible, but might not if an icon is available and the action bar is constrained for space.

Related Links

SOCKet Secure (SOCKS) server for Android
Android: NullPointer Exception on recreating the alarm on OS Bootup?
Android with thread shows error
Android Circular Motion of a Device
Android application for Tablet
Android SDK - Preloading a small images gets my application to exceed memory
PhoneGap Back Key Function
Need to Check if a particular location is within the boundaries of the map
Can xml resource files be updated from a server without shipping an app update?
How to write files in hidden mode on SD card in Android
Key alias access issue - Android App Export
How to scale layout in android
How do I layout list items to behave like a table rows?
Where to store sound files in the project and what solution to chose for storing refferences to them
onListItemClick for ListView not working - Android
How to get the size of an image in Android?

Categories

HOME
formal-languages
mysql-workbench
camera
sitecore
pdfbox
database-normalization
cublas
echo
crystal-reports-2013
mvc5
jtextpane
openstreetmap
gson
distribution
easyphp
google-picker
googlebot
gmock
roundup
tiki-wiki
definitelytyped
surveymonkey
entity-relationship-model
wcag
spotipy
tizen-tv
failover
corenlp-server
userdefaults
python-2.6
dst
twos-complement
android-maps-extensions
pdw-file-browser
raft
recurrent-neural-network
cin
flask-login
monkey-testing
httr
double-click
facebook-pixel
openblas
mach-o
offline.js
google-photos
choice
materialized-path-pattern
custom-lists
latin
vulcanize
tinkerpop3
signalr.client
cifilter
jaunt-api
phpgrid
vigenere
finalbuilder
dnssec
rrule
xmltype
cryptographichashfunction
nodelist
mruby
android-vibration
nsmenu
encryption-asymmetric
reflector
windows-embedded-standard
visual-studio-express
http-patch
script#
scringo
composite-component
pstack
nokia-s40
correlated-subquery
window-decoration
stress
procedures
filemerge
cgbitmapcontextcreate
clrstoredprocedure
xui
codebase
updatesourcetrigger
non-clustered-index
message-passing
openfaces
sifr
flvplayback
lemmatization
online-storage

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App