简体   繁体   English

使微调框和文本字段更小?(android)

[英]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. 因此,我是android世界的新手,并使用eclipse创建了非常基本的android应用程序。我有3个带有元素的微调器,问题是我需要将6个微调器与6个文本字段配合在一起(每个微调器旁边有1个文本字段)问题是我的微调器太大(其中的项目名称很长),每次我尝试减小图形布局中微调器或文本字段的大小时,它的大小都会恢复到原始大小。一种减小微调器大小的方法(无论所选元素的名称是否未完全出现在微调器中),还可以减小文本字段的大小?(我的文本字段实际上是数字字段)。请告诉我是否需要任何编码。

Thank you! 谢谢!

Check android:layout_weight setting. 检查android:layout_weight设置。 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. 如果您有两个对象,则在同一个水平linearLayout中具有文本字段和微调器,它们遵循父对象的大小,它们将以1:1的比例均匀分布。 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. 您可能还想使用GridLayout检出,您可以在其中指定控件进入的行和列。文档中列出了分配空间的方式。 http://developer.android.com/reference/android/widget/GridLayout.html 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". 我实际上在activity_main.xml文件中找到了要查找的内容,然后将dp中的android:layout_width和android:layout_height修改为所需的值,例如android:layout_height:“ 30dp”。 thanks for the answer still 还是谢谢你的回答

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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