English 中文(简体)
B. 不填充空间的定制无线电Button图像
原标题:Custom RadioButton image not filling space

I have a custom radiobutton with a 9-patch image as background. I use a Selector to determine the background. I also have some text i want to put over the background of the image, but the text is aligning next to the button.

这是广播集团。

<LinearLayout
    android:id="@+id/segmented"
    android:layout_width="fill_parent" 
    android:layout_height="50sp"
    android:gravity="center"
    android:layout_below="@+id/header">
    <RadioGroup android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:orientation="horizontal"
        android:id="@+id/group1"
        android:gravity="center">
        <RadioButton 
            android:checked="false"
            android:layout_width="90sp"
            android:id="@+id/rbVerzekeringen"
            android:text="Verzekeringen"
            android:textSize="10sp"
            android:button="@drawable/checkbox_theme" />
        <RadioButton 
            android:checked="false"
            android:layout_width="90sp"
            android:id="@+id/rbPersoonlijk"
            android:text="Persoonlijk"
            android:textSize="10sp"
            android:button="@drawable/checkbox_theme" />
        <RadioButton 
            android:checked="false"
            android:layout_width="90sp"
            android:id="@+id/rbNotities"
            android:text="Notities"
            android:textSize="10sp"
            android:button="@drawable/checkbox_theme" />
    </RadioGroup>
</LinearLayout>

这是挑选人:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:state_window_focused="false"
        android:drawable="@drawable/bt_filter_active" />
    <item android:state_checked="false" android:state_window_focused="false"
        android:drawable="@drawable/bt_filter" />
    <item android:state_checked="true" android:state_pressed="true"
        android:drawable="@drawable/bt_filter_active" />
    <item android:state_checked="false" android:state_pressed="true"
        android:drawable="@drawable/bt_filter" />
    <item android:state_checked="true" android:state_focused="true"
        android:drawable="@drawable/bt_filter_active" />
    <item android:state_checked="false" android:state_focused="true"
        android:drawable="@drawable/bt_filter" />
    <item android:state_checked="false" android:drawable="@drawable/bt_filter" />
    <item android:state_checked="true" android:drawable="@drawable/bt_filter_active" />
</selector>

这是它所认为的:

“alt

As you can figure out I want 3 large buttons with the text over it.

我如何能够这样做?

http://www.un.org。

我将挑选人置于背景之下,取代纽顿,并将纽伦定为无效。

法典现在就这样看:

<LinearLayout
    android:id="@+id/segmented"
    android:layout_width="fill_parent" 
    android:layout_height="50sp"
    android:gravity="center"
    android:layout_below="@+id/header">
    <RadioGroup android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:orientation="horizontal"
        android:id="@+id/group1"
        android:gravity="center">
        <RadioButton 
            android:checked="false"
            android:layout_width="100sp"
            android:layout_height="40sp"
            android:id="@+id/rbVerzekeringen"
            android:text="Verzekeringen"
            android:textSize="13sp"
            android:orientation="vertical"
            android:background="@drawable/checkbox_theme"
            android:button="@null"
            android:gravity="center"/>
        <RadioButton 
            android:checked="false"
            android:layout_width="100sp"
            android:layout_height="35sp"
            android:id="@+id/rbPersoonlijk"
            android:text="Persoonlijk"
            android:textSize="35sp"
            android:background="@drawable/checkbox_theme"
            android:button="@null" 
            android:gravity="center"/>
        <RadioButton 
            android:checked="false"
            android:layout_width="100sp"
            android:layout_height="30sp"
            android:id="@+id/rbNotities"
            android:text="Notities"
            android:textSize="13sp"
            android:background="@drawable/checkbox_theme"
            android:button="@null" 
            android:gravity="center"/>
    </RadioGroup>
</LinearLayout>

But now when I make the buttons larger or smaller the text in it just disappears like this (height of the first image is 40sp, the second is 35sp and the last one is 30sp): height of the first image is 40sp, the second is 35sp and the last one is 30sp

我怎么能够减少背景形象,同时又不削减案文?

最佳回答
问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签