我试图弄清楚如何在EditText小部件中嵌入除Drawables之外的东西.具体来说,我想到的例子来自Google Buzz小部件:
screenshot
(没有内嵌图片,抱歉,我是新手)
在不经意的观察者看来,整个布局对象固定在EditText的底部,包含ImageView,TextView和Button.
解决方法
EditText按钮……它是一个FrameLayout,其EditText带有fill_parent,Buttons带有layout_gravitiy:“bottom”.像这样的东西:
<?xml version="1.0" encoding="utf-8"?> <!-- Main Layout (may be relative or whatever --> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!-- Layout for edittext and button --> <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content"> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:lines="5"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right" android:layout_margin="5dip" android:text="Overflow"/> </FrameLayout> <!-- More layouts ..... --> </RelativeLayout>
原文地址:https://www.jb51.cc/android/315849.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。