android - Setting a global minHeight and/or minWidth -


i've drawable xml file, in set global parameters butons, using code like

    <shape android:shape="rectangle">      <corners android:radius="4dip" />     <stroke android:width="1dip" android:color="#555555" />     <solid android:color="#dddddd"/>     <size android:height="20dip"/>     </shape> 

that's ok, of course, default minheight of button seems 48dp, height of 20 nothing. know can use

     android:minheight="0dp"      android:minwidth="0dp"  

but want set these values "global" buttons. searching in android doc (https://developer.android.com/guide/topics/resources/drawable-resource.html#shape), seems minheight , minwidth not part of shape drawable. can set minheight , minwidth in global way? thanks

you want define custom button style , apply theme.

for example:

<style name="apptheme" parent="theme.appcompat.light.noactionbar">      <item name="buttonstyle">@style/smallerbuttonstyle</item>  </style>  <style name="smallerbuttonstyle" parent="widget.appcompat.button">     <item name="android:minheight">20dp</item> </style> 

this change every button in application default minimum height of 20dp.

if don't want every button small, can apply style individual <button> elements usual.

for more, see styles , themes documentation.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -