我怎样才能让我的TextView左侧和单选框与此code的权利? [英] How can I get my TextView to the left and the Radiobutton to the right with this code?

查看:60
本文介绍了我怎样才能让我的TextView左侧和单选框与此code的权利?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下布局的XML。我想TextView的放置在左侧,单选框的权利。我怎样才能做到这一点?

I have the following layout xml. I am trying to place the TextView to the left, and the Radiobutton to the right. How can I accomplish this?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content">
    <TextView
      android:id="@+id/txtVehName"
      android:hint="@string/VEH_NAME"
      android:textSize="18sp"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content">
    </TextView>
    <RadioButton
      android:id="@+id/rbDefault"
      android:text=""
      android:layout_width="wrap_content"
      android:layout_height="wrap_content">
    </RadioButton>
</LinearLayout>

感谢

帕特里克

推荐答案

谢谢大家对你的答案。

Thanks everyone for your answers.

CaseyB - 不知道为什么你的解决方案不会为我工作。这里是您的建议显示输出:

CaseyB - not sure why your solution won't work for me. here is the displayed output from your suggestion:

下面是这似乎为我工作的XML。

Here is the xml that seems to work for me.

<RelativeLayout  
  xmlns:android="http://schemas.android.com/apk/res/android" 
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content"> 
  <TextView 
      android:id="@+id/txtVehName" 
      android:hint="@string/VEH_NAME" 
      android:textSize="18dp" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"
      android:layout_marginTop="10dip"
      > 
    </TextView> 
    <RadioButton 
      android:id="@+id/rbDefault" 
      android:text="" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"
      android:layout_alignParentRight="true"
      > 
    </RadioButton> 
</RelativeLayout>

这里是emulater显示输出

here is the emulater display output

Eclipsed4utoo - 的DP而不是SP ...谢谢

Eclipsed4utoo - dp instead of sp...thanks

这篇关于我怎样才能让我的TextView左侧和单选框与此code的权利?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆