java - 非常大的数字选择器

标签 java android xml user-interface android-fragments

这是我的布局 XML 文件:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <ScrollView
        android:id="@+id/scroller"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        >

        <TableLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <TableRow
                android:id="@+id/tableRow1"
                android:layout_width="fill_parent"
                android:layout_height="50dp" >

                <RadioButton
                    android:id="@+id/radioButton1"
                    android:layout_width="wrap_content"
                    android:layout_height="50dp"
                    android:drawableRight="@android:drawable/btn_radio"
                    android:button="@null"
                    android:textSize="12sp"
                    android:text="RadioButton" />

                <NumberPicker
                    android:id="@+id/numberPicker1"
                    android:layout_width="wrap_content"
                    android:layout_height="50dp" />

            </TableRow>

            <TableRow
                android:id="@+id/tableRow2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

            </TableRow>

            <TableRow
                android:id="@+id/tableRow3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>

            <TableRow
                android:id="@+id/tableRow4"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
            </TableRow>
        </TableLayout>

    </ScrollView>



</RelativeLayout>

这里有一个大问题。请参见下图,了解 NumberPicker 有多大!

enter image description here

我需要的 NumberPicker 如下所示。

enter image description here

我尝试设置高度并固定,但似乎没有太大效果。此设计适用于手机和平板电脑。如何使这个 NumberPicker 变小,如上图所示?

最佳答案

使用

android:scaleX="0.5"
android:scaleY="0.5"

并发挥值(value)观。

关于java - 非常大的数字选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20561821/

相关文章:

java - 如何在 Java XPath 查询中使用 name() 和/或 node()?

xml - JMeter保存响应数据-非TEXT响应数据,无法记录: ()

java - 在 AndroidManifest 中授予 Activity 权限

java - 如何从 jTextFields 向 jTable 插入数据?

android - onRetainCustomNonConfigurationInstance 服务泄漏

android - com.google.api.client.googleapis.json.GoogleJsonResponseException : 404 Not Found in google app engine connected android project

java - 如何在 WebStart 进程中使用 JMX RMI 代理?

Java 应用程序不显示输出

java - "Unable to get provider com.google.firebase.provider.FirebaseInitProvider"Android路径错误

ios - 在 iOS 上保存 xml 文件(pugiXml 和 Cocos2d-x)