【发布时间】:2017-04-28 18:26:52
【问题描述】:
所以我有一个布局,我想在 1 个 CardView 中显示前三个 Inputlayouts/EditTexts... 下面是我的 XML 和一个图像,它看起来像什么都知道。
我希望你能帮助我。
非常感谢!! :)
这是我的Layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBackground">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.MainActivity">
<LinearLayout
android:id="@+id/information"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:orientation="vertical"
android:padding="16dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:gravity="center">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/field_education_year"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Ausbildungsjahr"
android:inputType="number"
android:maxLines="1" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:gravity="center">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="false">
<EditText
android:id="@+id/field_week_start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="false"
android:hint="week start"
android:inputType="text|date"
android:onClick="onClick" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:gravity="center">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="false">
<EditText
android:id="@+id/field_week_end"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="false"
android:hint="week end"
android:inputType="text|date"
android:onClick="onClick" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:gravity="center">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/field_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Title"
android:maxLines="1" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:gravity="center">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/field_notice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Notice"
android:inputType="textMultiLine"
android:scrollHorizontally="false" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab_submit_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_margin="16dp"
android:src="@drawable/ic_publish_new_report" />
</LinearLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
【问题讨论】:
-
你使用了很多可以直接用你的TextIputLayout替换的relativLayouts
-
@JonathanAste 对我没有帮助
-
不是您正在寻找的解决方案,但这就是为什么我把它放在评论中,只是一个建议;)
-
@JonathanAste ;)
标签: android android-layout android-linearlayout android-cardview android-relativelayout