[英]Adding widgets in xml layout
I am building an android app and I have copied few xmls from some website.The thing am trying to do is to add the button at the very right in the bottom of the screen but getting no success.There are two layout and one of which is merged with other.I don't know where to edit and put the button.I am confused.please help me where to put it.. 1st xml card_representation : 我正在构建一个android应用程序,并且已经从某个网站复制了一些xml文件。尝试做的是在屏幕底部的最右边添加按钮,但没有成功。有两种布局,其中一种与其他合并。我不知道在哪里编辑和放置按钮。我很困惑。请帮助我在哪里放置它。.1st xml card_representation:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="5dp" >
<ImageView
android:id="@+id/card"
android:layout_width="280dp"
android:layout_height="160dp"
android:background="@drawable/card_border"
android:gravity="center"
android:scaleType="centerCrop"
android:src="@drawable/emv_card_background" />
<TextView
android:id="@+id/bankName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/card"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:gravity="center"
android:text="Bank"
android:textColor="#999999"
android:textScaleX="1"
android:textSize="25sp"
android:textStyle="bold" >
</TextView>
<TextView
android:id="@+id/cardNumber"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/card"
android:layout_marginTop="77dp"
android:gravity="center"
android:text="3456 5456 6578 6543"
android:textColor="@android:color/black"
android:textSize="21sp"
android:textStyle="bold" >
</TextView>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/cardNumber"
android:layout_marginLeft="95dp"
android:layout_marginTop="35dp"
android:gravity="center"
android:orientation="horizontal" >
<TextView
android:id="@+id/cardValidityLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:gravity="left|center_vertical"
android:text="Expire"
android:textColor="@android:color/black"
android:textSize="11sp"
android:textStyle="bold" >
</TextView>
<TextView
android:id="@+id/cardValidity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="left"
android:text="12/14"
android:textColor="@android:color/black"
android:textSize="14sp"
android:textStyle="bold" >
</TextView>
</LinearLayout>
<ImageView
android:id="@+id/type"
android:layout_width="70dp"
android:layout_height="34dp"
android:layout_alignBottom="@+id/card"
android:layout_alignRight="@+id/card"
android:layout_marginBottom="15dp"
android:layout_marginRight="10dp"
android:scal
2nd xml is card_detail: 第二个xml是card_detail:
<?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" >
<ScrollView
android:id="@+id/card_detail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:visibility="gone" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/cardui"
android:orientation="vertical" >
<TextView
android:id="@+id/card_detail_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="@string/card_representation_title"
android:textColor="#999"
android:textSize="13sp"
android:textStyle="bold" />
<include layout="@layout/card_representation" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:background="@drawable/cardui"
android:orientation="vertical" >
<TextView
android:id="@+id/extended_card_detail_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="@string/extended_card_detail_title"
android:textColor="#999"
android:textSize="13sp"
android:textStyle="bold" />
<TableLayout
android:id="@+id/extended_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="7dp"
android:shrinkColumns="1"
>
</TableLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/emptyView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF"
android:gravity="center"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="@+id/contactLessImg"
android:layout_width="200dp"
android:layout_height="140dp"
android:scaleType="fitCenter"
android:src="@drawable/contactless" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/paycard_back_text"
android:textSize="17sp"
android:textStyle="bold" >
</TextView>
</LinearLayout>
</LinearLayout>
Screen looks like with this layout as: 屏幕看起来像这样的布局:
I want to add the button at the bottom of the screen in the right.Where should I edit..Please help Thanks in advance 我想在屏幕底部的右侧添加按钮。我应该在哪里编辑。请先帮助谢谢
Here you go .Edit card_detail with this: 在这里,用以下命令编辑card_detail:
<?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" >
<ScrollView
android:id="@+id/card_detail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:visibility="gone" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="@drawable/cardui"
android:orientation="vertical" >
<TextView
android:id="@+id/card_detail_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="@string/card_representation_title"
android:textColor="#999"
android:textSize="13sp"
android:textStyle="bold" />
<include layout="@layout/card_representation" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"
android:background="@drawable/cardui"
android:orientation="vertical" >
<TextView
android:id="@+id/extended_card_detail_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="@string/extended_card_detail_title"
android:textColor="#999"
android:textSize="13sp"
android:textStyle="bold" />
<TableLayout
android:id="@+id/extended_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="7dp"
android:shrinkColumns="1"
>
</TableLayout>
</LinearLayout>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="17dp"
android:layout_marginTop="29dp"
android:text="Proceed" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/emptyView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF"
android:gravity="center"
android:orientation="vertical"
android:padding="10dp" >
<ImageView
android:id="@+id/contactLessImg"
android:layout_width="200dp"
android:layout_height="140dp"
android:scaleType="fitCenter"
android:src="@drawable/contactless" />
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/paycard_back_text"
android:textSize="17sp"
android:textStyle="bold" >
</TextView>
</LinearLayout>
</LinearLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.