2017-02-17 55 views

回答

0

你问2问题的 1)我如何能在Android的得出这样的XML布局?

你应该尝试在那里你被卡住

2)如何在布局的中心底部位置的(X)按钮,一些XML代码和文章。

为此,将父布局用作“相对布局”,并将您查看(假设您具有ImageView)为layout_alignParentBottom = true和layout_centerHorizo​​ntal = true。你也可以参考下面的代码。用于定位

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Testing" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true"/> 

</RelativeLayout> 
1

使用相对布局使用的(X)的图像按钮与无背景色,并使用

<ImageButton android:id="@+id/btnid" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_gravity="center_vertical|center_horizontal" 
android:background="@drawable/(X)image"> 
</ImageButton>