布局没啥特别的
<EditText android:id="@+id/embedded_text_editor"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:autoText="true"
android:capitalize="sentences"
android:hint="@string/type_to_compose_text_enter_to_send"
android:textCursorDrawable="@null"
android:textColor="@android:color/black"
android:maxLines="4"
android:nextFocusRight="@+id/send_button"
android:gravity="top" />
<EditText android:id="@+id/embedded_text_editor"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:autoText="true"
android:capitalize="sentences"
android:hint="@string/type_to_compose_text_enter_to_send"
android:textCursorDrawable="@null"
android:textColor="@android:color/black"
android:maxLines="4"
android:nextFocusRight="@+id/send_button"
android:gravity="top" />
解决方案 »
- 本人想做一个小程序可以访问某个指定网页,打开之后每隔1分钟会自动刷新网页,请问该如何做呢
- Arcgis for Android 问题 无法启动调试...
- Android NDK开发用的SO库是用什么语言写的?
- 帮忙看一下报错log信息
- 【求助】怎么把Broadcast Receiver里面获取的数据传给Activity
- android wifi 是如何实现打开wifi后自动连接的
- 【100分求】网页在android系统浏览器上大小自适应的问题
- 现在什么广告平台比较好啊?
- 安卓开发:页面间跳转但不创建页面
- 用android怎么做一个定时拨号程序?望大神们不吝赐教!
- NDK如何自己获取到DVM地址?
- Android客户端调用wcf接口,为什么传入Byte[]类型的参数不行呢
//注意这里,到底是用ViewGroup还是用LinearLayout或者是FrameLayout,主要是看你这个EditTex
//控件所在的父控件是啥布局,如果是LinearLayout,那么这里就要改成LinearLayout.LayoutParams
ViewGroup.LayoutParams lp = editText.getLayoutParams();
lp.height = newHeight;
editText.setLayoutParams(lp);
嗯,谢谢,这个可以设置。。我想问下,有没有办法让那个edittext显示一行,因为要考虑手机分辨率的问题,可能设置固定的高度不好。。如果可以设置一行显示的,会感觉好一点
嗯,谢谢,这个可以设置。。我想问下,有没有办法让那个edittext显示一行,因为要考虑手机分辨率的问题,可能设置固定的高度不好。。如果可以设置一行显示的,会感觉好一点你在调用setMaxLines之前,先调用setSingleLine(false);
edittext.setSingleLine(false);
edittext.setMaxLines(2);
嗯,谢谢,这个可以设置。。我想问下,有没有办法让那个edittext显示一行,因为要考虑手机分辨率的问题,可能设置固定的高度不好。。如果可以设置一行显示的,会感觉好一点你在调用setMaxLines之前,先调用setSingleLine(false);
edittext.setSingleLine(false);
edittext.setMaxLines(2);没反应的啊,按你写的。不知道为啥,网上一般都是这样写的。。我把整个父布局贴出来
<LinearLayout
android:id="@+id/bottom_panel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="2dip"
android:paddingLeft="5dip"
android:paddingRight="5dip"
android:paddingTop="5dip" >
<RelativeLayout
android:id="@+id/editor_with_counter"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:orientation="horizontal" >
<EditText android:id="@+id/embedded_text_editor"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:autoText="true"
android:capitalize="sentences"
android:hint="@string/type_to_compose_text_enter_to_send"
android:textCursorDrawable="@null"
android:textColor="@android:color/black"
android:maxLines="4"
android:nextFocusRight="@+id/send_button"
android:gravity="top" />
嗯,谢谢,这个可以设置。。我想问下,有没有办法让那个edittext显示一行,因为要考虑手机分辨率的问题,可能设置固定的高度不好。。如果可以设置一行显示的,会感觉好一点你在调用setMaxLines之前,先调用setSingleLine(false);
edittext.setSingleLine(false);
edittext.setMaxLines(2);没反应的啊,按你写的。不知道为啥,网上一般都是这样写的。。我把整个父布局贴出来
<LinearLayout
android:id="@+id/bottom_panel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="2dip"
android:paddingLeft="5dip"
android:paddingRight="5dip"
android:paddingTop="5dip" >
<RelativeLayout
android:id="@+id/editor_with_counter"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:orientation="horizontal" >
<EditText android:id="@+id/embedded_text_editor"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:autoText="true"
android:capitalize="sentences"
android:hint="@string/type_to_compose_text_enter_to_send"
android:textCursorDrawable="@null"
android:textColor="@android:color/black"
android:maxLines="4"
android:nextFocusRight="@+id/send_button"
android:gravity="top" />
哦,对了
setSingleLine(false);要放在setText前面。
也就是最后再调用setText试试