我有一个RadioGroup rg1,我想获得所选单选按钮的值.
我知道我可以使用以下方法获取id所选单选按钮:
if(rg1.getCheckedRadioButtonId()!=-1)
int id= rg1.getCheckedRadioButtonId()
Run Code Online (Sandbox Code Playgroud)
这给了我id,但我想要那个按钮的值.
我想从servlet使用阿拉伯数据发送HTTPServletResponse到客户端
我正在尝试这个
response.setCharacterEncoding("UTF-8");
response.setHeader("Info", arabicWord);
Run Code Online (Sandbox Code Playgroud)
我收到这样的字眼
String arabicWord = response.getHeader("Info");
Run Code Online (Sandbox Code Playgroud)
在客户端(接收)也试过这个
byte[]d = response.getHeader("Info").getBytes("UTF-8");
arabicWord = new String(d);
Run Code Online (Sandbox Code Playgroud)
但似乎没有unicode,因为我收到奇怪的英语单词,所以请问我怎样才能发送和接收阿拉伯语utf8单词?
我有一个按钮,当我按下它时,我想删除它(不要让它看不见).我读到我可以使用layout.removeView(mybutton)但是布局是什么?我怎样才能在我的活动中得到它
Button showQuestion;
private void initialize() {
showQuestion = (Button) findViewById(R.id.bAnswerQuestionShowQuestion);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.bAnswerQuestionShowQuestion:
showQuestion.setVisibility(View.INVISIBLE);
//Here i want to delete the button
question.setVisibility(View.VISIBLE);
theAnswer.setVisibility(View.VISIBLE);
answerQuestion.setVisibility(View.VISIBLE);
showChoices.setVisibility(View.VISIBLE);
showHint.setVisibility(View.VISIBLE);
break;
}
}
Run Code Online (Sandbox Code Playgroud) 我想给用户四个选择,一行选择第一和第二个选择,另一行选择第三和第四个选择。我的问题是,当应用程序启动时,我可以选择多个选项,但我不希望这样。这是我的xml布局:
<RadioGroup
android:id="@+id/rgAnswerQuestionChoices"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/rAnswerQuestonChoic1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton"
android:visibility="invisible" />
<RadioButton
android:id="@+id/rAnswerQuestionChoice2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/rAnswerQuestionChoice3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton"
android:visibility="invisible" />
<RadioButton
android:id="@+id/rAnswerQuestionChoice4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="RadioButton"
android:visibility="invisible" />
</LinearLayout>
</RadioGroup>
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我如何在 android 上制作下拉列表?我用谷歌搜索并找到了很多结果,但从官方 android 网站上却是禁止的
我发现了一个叫做 List View
我将添加这些行,因为 stackoverflow 不允许我提交问题
<tag status="remove" because="can't add question"/>
int i=0; while(i=1;i<4;i++)
system.out.println("sorry");
<?Php
$word="sorry";
echo $word;
?>
Run Code Online (Sandbox Code Playgroud)
public class getCellsFromServer extends
AsyncTask<String, Integer, String[]> {
ProgressDialog dialog;
@Override
protected void onCancelled() {
super.onCancelled();
}
@Override
protected void onPostExecute(String[] results) {
super.onPostExecute(results);
final MyData items [] = new MyData[results.length];
for(int i=0;i<results.length;i++){
items[i]= new MyData(results[i],results[i]);
}
ArrayAdapter<MyData> adapter = new ArrayAdapter<MyData>(this,
android.R.layout.simple_spinner_item, items);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
}
@Override
protected void onPreExecute() {
super.onPreExecute(); …Run Code Online (Sandbox Code Playgroud) 我有一个菜单包含一个项目(退出应用程序的项目),我想设置一个图标到该项目,我正在这样工作(exit is the name of my icon);
<item android:id="@+id/bexitMenuExit"
android:title="Exit"
android:alphabeticShortcut="@drawable/exit"
android:icon="@android:drawable/ic_menu_preferences"
></item>
Run Code Online (Sandbox Code Playgroud)
但我没有在项目上的图标,我没有找到android:icon退出,我找到了帮助,设置...,但不是为exti