Android开发_如何实现留言意见反馈功能界面


(此贴转载)解决打开界面时,EditText控件获得焦点,并弹出输入对话框问题。

    解释产生原因 :在打开android 界面时,android 默认让第一个操作控件获得焦点。
    解决的思路 :在文本框控件前面访一个隐藏的控件,并使其获得焦点。

   < LinearLayout
        android:focusable="true" android:focusableInTouchMode="true"
        android:layout_width="0px" android:layout_height="0px"/>

1 界面部分区域设置滚动栏效果
设置滚动效果注意事项:
  • ScrollView包含的子控件,只能是一个,在多个的情况下会报错。
  •   LinearLayout设置滚动效果无效。
2 设置EditText 控件为多行编辑控件
    < EditText android:text=""
              android:id="@+id/help_feedback"  
              android:lines="5"
              android:gravity="top"
              android:hint=" 请输入您的反馈意见(字数500以内)"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"></EditText>


界面布局

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ScrollView" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:scrollbars="vertical">
    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:orientation="vertical"
    android:background="#ffffff"
    android:layout_height="fill_parent">


    <TextView android:text="意见反馈"
    android:id="@+id/help_title"
    android:background="#1788D8"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:layout_width="fill_parent"
    android:textColor="#ffffff"
    android:layout_height="wrap_content"></TextView>
    <LinearLayout
    android:focusable="true" android:focusableInTouchMode="true"
    android:layout_width="0px" android:layout_height="0px"/>
    <EditText android:text=""
    android:id="@+id/help_feedback"
    android:lines="5"
    android:gravity="top"
    android:hint="请输入您的反馈意见(字数500以内)!"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"></EditText>
    <LinearLayout
    android:layout_width="fill_parent"
    android:orientation="vertical"
    android:gravity="center"
    android:layout_height="wrap_content">
    <Button android:text=""
    android:id="@+id/but_help_feedback"
    android:background="@drawable/help_submit"

    android:layout_width="wrap_content"
    android:layout_height="wrap_content"></Button>
    </LinearLayout>

    <TextView android:text="下面是常见问题"
    android:id="@+id/help_allseequestions"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:layout_width="fill_parent"
    android:textColor="#000000"
    android:layout_marginTop="10px"
    android:layout_height="wrap_content"></TextView>
    <TextView android:layout_marginTop="10px"
    android:paddingLeft="15px"
    android:layout_height="wrap_content"
    android:textColor="#000000"
    android:text="Q:积分怎么样获得,有什么好处? \n A:在回答问题正确后,获取积分,积分代表你当前回答问题的能力水平."
    android:layout_width="fill_parent"
    android:id="@+id/help_1"></TextView>

    <TextView android:layout_marginTop="10px"
    android:layout_height="wrap_content"
    android:textColor="#000000"
    android:paddingLeft="15px"
    android:text="Q:重新做练习主题,是否可以更新积分? \n A:可以,积分去当前最高分"
    android:layout_width="fill_parent"
    android:id="@+id/help_2"

    ></TextView>

    <TextView android:layout_marginTop="10px"
    android:layout_height="wrap_content"
    android:textColor="#000000"
    android:paddingLeft="15px"
    android:text="Q:未做结束后的主题退出后,是否可以重新做? \n A:可以继续重新做,且上次的测试时间保留."
    android:layout_width="fill_parent"
    android:id="@+id/help_3"

    ></TextView>

    <TextView android:layout_marginTop="10px"
    android:layout_height="wrap_content"
    android:textColor="#000000"
    android:paddingLeft="15px"
    android:text="Q:已经做完的测试主题是否可以再做? \n A:不可以."
    android:layout_width="fill_parent"
    android:id="@+id/help_4"

    ></TextView>
    <TextView android:layout_marginTop="10px"
    android:layout_height="wrap_content"
    android:textColor="#000000"
    android:paddingLeft="15px"
    android:text="Q:回答问题,获得积分的规则 \n A:用时低于60s ,获得100分 ;用时大于60秒,获得100*(60/用时)"
    android:layout_width="fill_parent"
    android:id="@+id/help_5"></TextView>

    </LinearLayout>
    </ScrollView> 



java

public class FeedBack extends Activity {
EditText help_feedback=null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.help);

//获取按钮
Button but_help_feedback=(Button)findViewById(R.id.but_help_feedback);
help_feedback=(EditText)findViewById(R.id.help_feedback);

//添加点击事件 ,保存文本信息,并生成提示,同时跳转到主界面
but_help_feedback.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View v){
String Context =help_feedback.getText().toString();;
//保存
try{
//调用网络接口,实现登陆指令
Boolean flags= UserDataServiceHelper.SendFeedBack(new UserDataReadHelper(Help.this).GetUserNiceName(), Context);

Toast.makeText(Help.this, "感谢您的反馈,我们会尽快处理您的意见。", Toast.LENGTH_SHORT).show();
ViewUtility.NavigateActivate((Activity)Help.this, Main.class);
}
catch(Exception e)
{
e.printStackTrace();
}
finally{

}
}
});


}

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK){
ViewUtility.NavigateActivate(Help.this, Main.class);
}
return false;
}
}



  • 4
    点赞
  • 31
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值