我想让2个观点像这样并排:
标题:EditText
但问题是android:orientation="vertical"
中的LinearLayout
,我可以做到吗?
这是我的代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">
<EditTextView
android:layout_width="wrap_content"
android:layout_height="58dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/edittext" />
<TextView
android:layout_width="wrap_content"
android:layout_height="34dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="@+id/textView"
android:layout_alignParentBottom="true" />
</LinearLayout>
答案 0 :(得分:0)
用于两种观点:
android:layout_weight="1"
插入垂直布局中插入的水平布局
答案 1 :(得分:0)
尝试以下方法:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3">
<EditTextView
android:layout_width="0dp"
android:layout_height="58dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/edittext"
android:layout_weight="2"/>
<TextView
android:layout_width="0dp"
android:layout_height="34dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="@+id/textView"
android:layout_weight="1" />
</LinearLayout>