I want to group two textviews in a group and use like a label and value. Is there any component to group two textviews in android? How can it be accomplished in android layout?
You can use <LinearLayout>
to group elements horizontaly. Also you should use style to set margins, background and other properties. This will allow you not to repeat code for every label you use. Here is an example:
<LinearLayout style="@style/FormItem" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView style="@style/FormLabel" android:layout_width="wrap_content" android:layout_height="@dimen/default_element_height" android:text="@string/name_label" /> <EditText style="@style/FormText.Editable" android:id="@+id/cardholderName" android:layout_width="wrap_content" android:layout_height="@dimen/default_element_height" android:layout_weight="1" android:gravity="right|center_vertical" android:hint="@string/card_name_hint" android:imeOptions="actionNext" android:singleLine="true" /> </LinearLayout>
Also you can create a custom view base on the layout above. Have you looked at Creating custom view ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With