简体   繁体   中英

making spinner and text field smaller?(android)

so im new to the world of android and im using eclipse to create very basic android apps.I have 3 spinner with elements in it, the problem is that I need to fit 6 spinner with 6 text fields(1 text field beside each spinner) and the problem is that my spinner are too large(my items in them have long names) and each time I try to reduce the size of a spinner or text field in the graphical layout,it just size back to its original size.Is there a way to reduce the size of the spinner(no matter if the name of the selected element doesnt fully appear in the spinner) and also reduce the size of the text field?(my text field are number field actually).Just tell me if any coded is needed.

Thank you!

Check android:layout_weight setting. May be what you are looking for. Found > here <. If you have two objects, in your case a text field and a spinner in the same horizontal linearLayout whose folloing the parent's size, they will evenly spread out on a 1:1 ratio. Therfor your spinner will take up half of the section of the screen and your title the other.

  • Weight is a good feature for matching variable screen sizes.

You may also want to check out using a GridLayout, where you can specify which row and column the control goes in. The ways to distribute space are listed in the documentation. http://developer.android.com/reference/android/widget/GridLayout.html

I actually found out what I was looking for, its in the activity_main.xml file, I modified android:layout_width and android:layout_height to desired value in dp, example, android:layout_height:"30dp". thanks for the answer still

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM