
如何自定义FrameLayout,我必须像这样制作屏幕:
我做了这个:
所以现在我想知道,如何实现以上布局
>如何在上方显示图标,例如在屏幕上方(路径)
>如何在圆形上方放置文本,例如在屏幕上方(深色文本:记住生活)(浅色文本:即刻….)
>如何将按钮放置在圆圈下方,例如在屏幕上方(注册并登录)
这是我在其中使用FrameLayout的XML,请参见下文:
<?xml version="1.0" enCoding="utf-8"?><FrameLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:app="http://schemas.androID.com/apk/res/com.indianic.vIEwflipperdemo" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:orIEntation="vertical" > <com.indianic.vIEwflipperdemo.Widget.VIEwFlow androID:ID="@+ID/vIEwflow" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" app:sIDebuffer="3" > </com.indianic.vIEwflipperdemo.Widget.VIEwFlow> <com.indianic.vIEwflipperdemo.Widget.CircleFlowIndicator androID:ID="@+ID/vIEwflowindic" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_gravity="bottom|center_horizontal" androID:padding="10dip" androID:layout_marginBottom="10dip" app:inactiveType="stroke" /></FrameLayout>解决方法:
最终,我实现了目标,我同时使用Layouts [relative Layout和linear Layout]来组织小部件,请参阅完整的XML:
circle_layout.xml:-
<?xml version="1.0" enCoding="utf-8"?><relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" xmlns:app="http://schemas.androID.com/apk/res/com.indianic.vIEwflipperdemo" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" androID:orIEntation="vertical" > <com.indianic.vIEwflipperdemo.Widget.VIEwFlow androID:ID="@+ID/vIEwflow" androID:layout_wIDth="fill_parent" androID:layout_height="fill_parent" app:sIDebuffer="3" > </com.indianic.vIEwflipperdemo.Widget.VIEwFlow> <ImageVIEw androID:ID="@+ID/imageVIEw1" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignParenttop="true" androID:layout_centerHorizontal="true" androID:layout_margintop="30dp" androID:src="@drawable/ic_launcher" /> <TextVIEw androID:ID="@+ID/textVIEw1" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_above="@+ID/textVIEw2" androID:layout_centerHorizontal="true" androID:text="Remember life" androID:textAppearance="?androID:attr/textAppearanceMedium" androID:textStyle="bold" /> <TextVIEw androID:ID="@+ID/textVIEw2" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_above="@+ID/vIEwflowindic" androID:layout_centerHorizontal="true" androID:layout_marginleft="30dp" androID:layout_marginRight="30dp" androID:padding="5dp" androID:text="Instantly search memorIEs of frIEnds, season, birthdays, and more" androID:textAppearance="?androID:attr/textAppearanceSmall" /> <linearLayout androID:ID="@+ID/linearLayout1" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_alignParentBottom="true" androID:layout_alignParentleft="true" androID:orIEntation="horizontal" androID:paddingBottom="10dp" androID:paddingleft="20dp" androID:paddingRight="20dp" androID:paddingtop="10dp" > <button androID:ID="@+ID/textVIEw" androID:layout_wIDth="0dp" androID:layout_height="wrap_content" androID:layout_gravity="left|center" androID:layout_weight="1" androID:text="Register" androID:textcolor="#000000" /> <button androID:layout_wIDth="0dp" androID:layout_height="wrap_content" androID:layout_gravity="right" androID:layout_weight="1" androID:text="Login" androID:textcolor="#000000" /> </linearLayout> <com.indianic.vIEwflipperdemo.Widget.CircleFlowIndicator androID:ID="@+ID/vIEwflowindic" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_above="@+ID/linearLayout1" androID:layout_centerHorizontal="true" androID:padding="20dp" app:inactiveType="stroke" /></relativeLayout>看看这个很棒的屏幕截图:
总结以上是内存溢出为你收集整理的android-如何自定义布局全部内容,希望文章能够帮你解决android-如何自定义布局所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)