调整XML布局,里面放上一个ImageView的图标按钮 [英] Adjust xml layout and place an icon button inside ImageView
本文介绍了调整XML布局,里面放上一个ImageView的图标按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮我调整我的XML布局?我需要认真帮助。
这是我的XML怎么看起来像
XML
<?XML版本=1.0编码=UTF-8&GT?;
<滚动型
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =1
机器人:fillViewport =真
机器人:方向=垂直
的xmlns:机器人=http://schemas.android.com/apk/res/android>< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:方向=垂直的android:layout_width =match_parent
机器人:layout_height =match_parent
机器人:背景=@的mipmap / dark_blue
机器人:weightSum =1>
<的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:textAppearance =机器人:ATTR / textAppearanceLarge
机器人:文字=输入理赔信息
机器人:ID =@ + ID / textViewClaims
机器人:paddingTop =30sp
机器人:TEXTSIZE =20dp
机器人:paddingLeft =15sp
机器人:文字颜色=@色/白
机器人:layout_weight = /&GT0.05; <查看
机器人:layout_width =340sp
机器人:layout_height =2DP
机器人:paddingLeft =100SP
机器人:背景=#C0C0C0/> <的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:textAppearance =机器人:ATTR / textAppearanceLarge
机器人:文字=索赔类型:
机器人:paddingTop =20SP
机器人:paddingLeft =15sp
机器人:TEXTSIZE =17dp
机器人:文字颜色=@色/白
机器人:ID =@ + ID / textViewClaimsType
机器人:layout_weight = /&GT0.05; <微调
机器人:layout_width =342dp
机器人:paddingLeft =40SP
机器人:背景=@彩色/ light_gray
机器人:layout_height =48dp
机器人:ID =@ + ID /微调/> <的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:textAppearance =机器人:ATTR / textAppearanceLarge
机器人:文字=索赔金额:
机器人:paddingTop =20SP
机器人:paddingLeft =15sp
机器人:TEXTSIZE =17dp
机器人:文字颜色=@色/白
机器人:ID =@ + ID / textViewAmount
机器人:layout_weight = /&GT0.05; <的EditText
机器人:layout_width =323dp
机器人:layout_height =WRAP_CONTENT
机器人:layout_margin =10SP
机器人:背景=@绘制/ round_corner_square
机器人:ID =@ + ID / editTextAmount
机器人:paddingLeft =20dp
机器人:layout_weight = /&GT0.05; < ImageView的
机器人:layout_width =7458dp
机器人:layout_height =WRAP_CONTENT
机器人:ID =@ + ID / ImageView的/> <的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:textAppearance =机器人:ATTR / textAppearanceLarge
机器人:文字=输入内容
机器人:paddingTop =20SP
机器人:paddingLeft =15sp
机器人:TEXTSIZE =17dp
机器人:文字颜色=@色/白
机器人:ID =@ + ID / textView12
机器人:layout_weight = /&GT0.05; <的EditText
机器人:layout_width =325dp
机器人:layout_height =WRAP_CONTENT
机器人:layout_margin =10dp
机器人:背景=@绘制/ round_corner_square
机器人:layout_weight =0.05
机器人:paddingLeft =20dp
机器人:paddingBottom会=80dp
机器人:layout_x =14dp
机器人:layout_y =146dp
机器人:ID =@ + ID / textDescription/> <按钮
机器人:layout_width =159dp
机器人:layout_height =WRAP_CONTENT
机器人:文字=拯救
机器人:ID =@ + ID /按钮
机器人:layout_gravity =CENTER_HORIZONTAL
机器人:layout_weight = /&GT0.05;
< / LinearLayout中>
< /滚动型>
问题:
- 如何将微调器右侧的视线?
- 将白线进入索赔之间和索赔键入正确
- 缩小向下跌破之间的
editTextAmount
空格ClaimsAmount
文本 - 查看图像不显示。它应该把下面
editTextAmount
- 如何添加一个图标
按钮
在的ImageView
我很抱歉,如果我在这里问了很多。任何帮助将大大AP preciated。
使用后@tiny回答
解决方案
<?XML版本=1.0编码=UTF-8&GT?;
<滚动型
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =1
机器人:fillViewport =真
机器人:方向=垂直
的xmlns:机器人=http://schemas.android.com/apk/res/android> < LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:方向=垂直的android:layout_width =match_parent
机器人:layout_height =match_parent
机器人:背景=@的mipmap / dark_blue
机器人:weightSum =1>
<的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:textAppearance =机器人:ATTR / textAppearanceLarge
机器人:文字=输入理赔信息
机器人:ID =@ + ID / textViewClaims
机器人:paddingTop =30sp
机器人:TEXTSIZE =20dp
机器人:paddingLeft =15sp
机器人:文字颜色=@色/白
机器人:layout_weight = /&GT0.05; <查看
机器人:layout_gravity =右
机器人:layout_width =340sp
机器人:layout_height =2DP
机器人:背景=#C0C0C0/> <的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:textAppearance =机器人:ATTR / textAppearanceLarge
机器人:文字=索赔类型:
机器人:paddingTop =20SP
机器人:paddingLeft =15sp
机器人:TEXTSIZE =17dp
机器人:文字颜色=@色/白
机器人:ID =@ + ID / textViewClaimsType
机器人:layout_weight = /&GT0.05; <微调
机器人:layout_gravity =右
机器人:重力=右
机器人:layout_width =150dp
机器人:paddingLeft =0dp
机器人:背景=@彩色/ light_gray
机器人:layout_height =48dp
机器人:ID =@ + ID /微调/> <的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:textAppearance =机器人:ATTR / textAppearanceLarge
机器人:文字=索赔金额:
机器人:paddingTop =20SP
机器人:paddingLeft =15sp
机器人:TEXTSIZE =17dp
机器人:文字颜色=@色/白
机器人:ID =@ + ID / textViewAmount
机器人:layout_weight = /&GT0.05; <的EditText
机器人:layout_width =323dp
机器人:layout_height =WRAP_CONTENT
机器人:layout_margin =2DP
机器人:背景=@绘制/ round_corner_square
机器人:ID =@ + ID / editTextAmount
机器人:paddingLeft =20dp
机器人:layout_weight = /&GT0.05;
<的FrameLayout
机器人:layout_width =match_parent
机器人:layout_height =200dp>
< ImageView的
机器人:layout_gravity =中心
机器人:adjustViewBounds =真
机器人:scaleType =fitXY
机器人:SRC =@绘制/ ic_launcher
机器人:layout_width =200dp
机器人:layout_height =200dp
机器人:ID =@ + ID / ImageView的/>
<按钮
机器人:比重=中心
机器人:layout_width =159dp
机器人:layout_height =WRAP_CONTENT
机器人:文字=拯救
机器人:ID =@ + ID /按钮
机器人:layout_marginBottom =3DP
机器人:layout_gravity =CENTER_HORIZONTAL |底
机器人:layout_weight = /&GT0.05;
< /&的FrameLayout GT;
<的TextView
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:textAppearance =机器人:ATTR / textAppearanceLarge
机器人:文字=输入内容
机器人:paddingTop =20SP
机器人:paddingLeft =15sp
机器人:TEXTSIZE =17dp
机器人:文字颜色=@色/白
机器人:ID =@ + ID / textView12
机器人:layout_weight = /&GT0.05; <的EditText
机器人:layout_width =325dp
机器人:layout_height =WRAP_CONTENT
机器人:layout_margin =10dp
机器人:背景=@绘制/ round_corner_square
机器人:layout_weight =0.05
机器人:paddingLeft =20dp
机器人:paddingBottom会=80dp
机器人:layout_x =14dp
机器人:layout_y =146dp
机器人:ID =@ + ID / textDescription/> <按钮
机器人:layout_width =159dp
机器人:layout_height =WRAP_CONTENT
机器人:文字=拯救
机器人:ID =@ + ID /按钮
机器人:layout_gravity =CENTER_HORIZONTAL
机器人:layout_weight = /&GT0.05;
< / LinearLayout中>
< /滚动型>
Can someone please help me to adjust my xml layout ? I need seriously help.
This is how my xml looked like
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"
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>
Problem:
- How to move the spinner to right hand sight?
- Move the white line between enter claims and claims type to right
- Narrow down the space between
editTextAmount
belowClaimsAmount
text - Image View doesn't show. It should place below
editTextAmount
- How to add an icon
button
insideimageView
?
I'm sorry if I ask a lot here. Any help would be greatly appreciated.
After use @tiny answer
解决方案
<?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_gravity="right"
android:layout_width="340sp"
android:layout_height="2dp"
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_gravity="right"
android:gravity="right"
android:layout_width="150dp"
android:paddingLeft="0dp"
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="2dp"
android:background="@drawable/round_corner_square"
android:id="@+id/editTextAmount"
android:paddingLeft="20dp"
android:layout_weight="0.05" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="200dp">
<ImageView
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/ic_launcher"
android:layout_width="200dp"
android:layout_height="200dp"
android:id="@+id/imageView" />
<Button
android:gravity="center"
android:layout_width="159dp"
android:layout_height="wrap_content"
android:text="save"
android:id="@+id/button"
android:layout_marginBottom="3dp"
android:layout_gravity="center_horizontal|bottom"
android:layout_weight="0.05" />
</FrameLayout>
<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>
这篇关于调整XML布局,里面放上一个ImageView的图标按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文