Android 调整xml布局并在ImageView内放置图标按钮
有人能帮我调整一下xml布局吗?我真的需要帮助 这就是我的xml的样子 xmlAndroid 调整xml布局并在ImageView内放置图标按钮,android,xml,android-layout,Android,Xml,Android Layout,有人能帮我调整一下xml布局吗?我真的需要帮助 这就是我的xml的样子 xml <?xml version="1.0" encoding="utf-8"?> <ScrollView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:fillViewport="true" an
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fillViewport="true"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@mipmap/dark_blue"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Enter Claims Information"
android:id="@+id/textViewClaims"
android:paddingTop="30sp"
android:textSize="20dp"
android:paddingLeft="15sp"
android:textColor="@color/white"
android:layout_weight="0.05" />
<View
android:layout_width="340sp"
android:layout_height="2dp"
android:paddingLeft="100sp"
android:background="#c0c0c0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Claims Type : "
android:paddingTop="20sp"
android:paddingLeft="15sp"
android:textSize="17dp"
android:textColor="@color/white"
android:id="@+id/textViewClaimsType"
android:layout_weight="0.05" />
<Spinner
android:layout_width="342dp"
android:paddingLeft="40sp"
android:background="@color/light_gray"
android:layout_height="48dp"
android:id="@+id/spinner" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Claims Amount :"
android:paddingTop="20sp"
android:paddingLeft="15sp"
android:textSize="17dp"
android:textColor="@color/white"
android:id="@+id/textViewAmount"
android:layout_weight="0.05" />
<EditText
android:layout_width="323dp"
android:layout_height="wrap_content"
android:layout_margin="10sp"
android:background="@drawable/round_corner_square"
android:id="@+id/editTextAmount"
android:paddingLeft="20dp"
android:layout_weight="0.05" />
<ImageView
android:layout_width="7458dp"
android:layout_height="wrap_content"
android:id="@+id/imageView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Enter Description"
android:paddingTop="20sp"
android:paddingLeft="15sp"
android:textSize="17dp"
android:textColor="@color/white"
android:id="@+id/textView12"
android:layout_weight="0.05" />
<EditText
android:layout_width="325dp"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/round_corner_square"
android:layout_weight="0.05"
android:paddingLeft="20dp"
android:paddingBottom="80dp"
android:layout_x="14dp"
android:layout_y="146dp"
android:id="@+id/textDescription" />
<Button
android:layout_width="159dp"
android:layout_height="wrap_content"
android:text="save"
android:id="@+id/button"
android:layout_gravity="center_horizontal"
android:layout_weight="0.05" />
</LinearLayout>
</ScrollView>
问题:
editTextAmount
下方ClaimsAmount
文本之间的间距editTextAmount
图像视图
中添加图标按钮
您必须使用
RelativeLayout
而不是LinearLayout
,线性布局将视图一个接一个地线性排列,在相对布局中,您可以根据需要自定义子视图(如ImageView
,微调器
等)。如果使用RelativeLayout
您没有看到图像,因为您没有向图像视图提供图像。这里是文档您必须使用
相对视图
而不是线性布局
,线性布局将视图一个接一个地线性排列,在相对布局中,您可以根据需要自定义子视图(如图像视图
,微调器
等)。如果使用RelativeLayout
您没有看到图像,因为您没有向图像视图提供图像。这里是文档
添加左边距-
<Spinner
android:layout_width="342dp"
android:layout_height="48dp"
android:background="@color/light_gray"
android:layout_marginLeft="40dp"
android:id="@+id/spinner" />
将图像添加到图像视图中。它将变得可见,因为它现在是包装内容。无论何时进行填充或边距设置,请使用dp而不是sp.左加边距-
<Spinner
android:layout_width="342dp"
android:layout_height="48dp"
android:background="@color/light_gray"
android:layout_marginLeft="40dp"
android:id="@+id/spinner" />
将图像添加到图像视图中。它将变得可见,因为它现在是包装内容。无论何时进行填充或边距设置,请使用dp而不是sp。请添加屏幕截图,说明您的操作方式want@Ishan我想将微调器和线条稍微向右移动,并在
editTextAmount
之后添加一个imageView。imageView应该在中间。我为您添加了一个布局,您应该将所有sp替换为dp。dp更好。@tinysunlight如何将imageView中的按钮设置为底部?将重力设置为底部,如果需要一些空间,请使用layout_marginBottom。我编辑了它。请添加屏幕截图如何你want@Ishan我想将微调器和线条稍微向右移动,并在editTextAmount
之后添加一个imageView。imageView应该在中间。我为您添加了一个布局,您应该将所有sp替换为dp。dp更好。@tinysunlight如何将imageView中的按钮设置为底部?将重力设置为底部,如果需要一些空间,请使用layout_marginBottom。我编辑了它。我接受这个微小的答案,因为她的答案更符合我的问题。我肯定会投你们一票:)我接受这个微小的回答,因为她的回答更符合我的问题。我肯定会给你投票:)你能看到吗?我使用您提供的答案,但模拟器运行缓慢。你有什么想法吗?谢谢你看到了吗?我使用您提供的答案,但模拟器运行缓慢。你有什么想法吗?谢谢