【发布时间】:2012-08-06 16:32:17
【问题描述】:
我想在单选组中的单选按钮旁边设置视图。我试过了,但我没有。请任何人帮助我。
源代码
<?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="fill_parent"
android:orientation="vertical"
android:background="#FFFFFF">
<RadioGroup
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:checkedButton="@+id/view_completehistroy_rb"
android:id="@+id/timeframe_group">
<!-- View complete history Radio Button -->
<RadioButton
android:text="Complete History"
android:textSize="16sp"
android:layout_marginLeft="5dp"
android:id="@+id/view_completehistroy_rb"
android:textColor="#000000"
/>
<!-- View history using date range Radio Button -->
<RadioButton
android:text="From"
android:textSize="16sp"
android:layout_marginLeft="5dp"
android:textColor="#000000"
android:id="@+id/view_daterange_history_rb"/>
</RadioGroup>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!--Layout for Time selection -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="5dp"
android:layout_toRightOf="@id/view_daterange_history_rb">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:text="test1"
android:textColor="#000000"
android:textSize="16sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"
android:layout_marginRight="5dip"
android:text="test2"
android:textColor="#000000"
android:textSize="16sp"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
【问题讨论】:
-
我认为这是不可能的。但是,如果您解释为什么需要放置它,我们可以找到其他方法。我认为您想在这些文本视图中显示两个日期。对吗?
-
这里我想使用日期范围选项,例如“从日期选择器到日期选择器”,这就是为什么
-
基于此评论,@RahmathullahMPulikkal 的回答应该是最好的解决方案,而不是尝试在其旁边放置一个新视图
标签: android radio-group