小编rou*_*ill的帖子

样式EditText内容'即时'?

我正在使用Android中的富文本编辑器.基本上它有粗体,斜体和链接按钮,它们与EditText相关联,以改变内容的样式.如果您首先选择要设置样式的文本,然后使用此方法选择按钮,我可以使用它:http://developer.android.com/guide/appendix/faq/commontasks.html#selectingtext.

我要做的是让它像富文本编辑器一样工作,你可以使用按钮作为切换来根据需要设置文本样式,然后再次单击切换以停止使用样式.所以如果我想输入' 注意这个!'以粗体显示,我会点击'B'按钮,然后开始输入文字,我输入的所有内容都是粗体,直到我再次点击'B'按钮.

关于如何解决这个问题的任何想法?我希望我已经足够清楚了:)

android coding-style android-edittext

6
推荐指数
2
解决办法
8177
查看次数

在ScrollView中的EditText中启用滚动

我们的应用程序(WordPress for Android)使用滚动视图作为新的帖子视图,用户可以在其新的博客帖子中输入.此视图上有很多字段,包括post content字段的大型EditText.

看起来当EditText位于ScrollView中时,ScrollView将接管滚动操作,因此如果用户正在编写大型帖子,则无法 EditText区域滚动.可以做什么,以便滚动将在EditText和ScrollView中工作?

这是该视图的布局xml,任何帮助将不胜感激!需要滚动的EditText是@id/content:

    <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:scrollbars="none"
    android:background="#FFF5F5F5">

<RelativeLayout android:layout_width="fill_parent" 
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:padding="10dip"
                > 
    <RelativeLayout android:layout_width="fill_parent" 
                android:layout_height="fill_parent"
                android:background="@drawable/content_bg"
                android:id="@+id/section1">
    <TextView android:id="@+id/l_section1" 
              android:layout_width="fill_parent" 
              android:layout_height="wrap_content"
              android:text="Post Content"
              style="@style/WordPressSectionHeader"/>
    <TextView android:id="@+id/l_title" 
              android:layout_below="@id/l_section1"
              android:layout_width="fill_parent" 
              android:layout_height="wrap_content" 
              android:text="@string/post_title"/>

    <EditText android:id="@+id/title" 
              android:minHeight="40dip"
              android:layout_width="fill_parent" 
              android:layout_height="wrap_content" 
              android:background="@android:drawable/editbox_background"
              android:autoText="true"
              android:capitalize="sentences"
              android:layout_below="@id/l_title"/>

    <TextView android:id="@+id/l_content" 
              android:layout_width="fill_parent" 
              android:layout_height="wrap_content" 
              android:text="@string/post_content"
              android:layout_below="@id/title"/>

    <EditText android:id="@+id/content"
              android:gravity="top" 
              android:layout_width="fill_parent" 
              android:layout_height="wrap_content" 
              android:background="@android:drawable/editbox_background"
              android:minLines="5"
              android:maxLines="5"
              android:autoText="true"
              android:capitalize="sentences"
              android:layout_below="@id/l_content"/>

<Button  
            android:id="@+id/bold"
            android:background="@drawable/wp_button_small"
            android:layout_width="wrap_content"  
            android:layout_height="wrap_content"
            android:layout_below="@id/content"
            android:textStyle="bold"
            android:textSize="22dip" …
Run Code Online (Sandbox Code Playgroud)

layout android scrollview android-edittext

5
推荐指数
1
解决办法
3354
查看次数