第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

我把走馬燈效果和自動匹配放在一個程序里卻沒法運行,求助大神們?。。?/h1>
布局部分:
<?xml?version="1.0"?encoding="utf-8"?>
<LinearLayout?xmlns:android="http://schemas.android.com/apk/res/android"
????android:layout_width="match_parent"
????android:layout_height="match_parent"
????android:gravity="center_horizontal"
????android:orientation=?"vertical">

????<com.example.lenovo.learn.Marquee
????????android:id="@+id/textView"
????????android:layout_width="wrap_content"
????????android:layout_height="wrap_content"
????????android:singleLine="true"
????????android:ellipsize="marquee"
????????android:focusable="true"
????????android:focusableInTouchMode="true"
????????android:text="@string/layout1"?/>

????<AutoCompleteTextView
????????android:id="@+id/autoCompleteTextView"
????????android:layout_width="match_parent"
????????android:layout_height="wrap_content"
????????android:completionThreshold="2"
????????android:hint="請輸入搜索內容"?/>

????<Button
????????android:id="@+id/button"
????????android:layout_width="wrap_content"
????????android:layout_height="wrap_content"
????????android:text="Button"?/>
</LinearLayout>
Marquee部分:
package?com.example.lenovo.learn;

import?android.content.Context;
import?android.util.AttributeSet;
import?android.widget.TextView;

public?class?Marquee?extends?TextView?{
????public?Marquee(Context?context)?{
????????super(context);
????}

????public?Marquee(Context?context,?AttributeSet?attrs)?{
????????super(context,?attrs);
????}

????public?Marquee(Context?context,?AttributeSet?attrs,?int?defStyleAttr)?{
????????super(context,?attrs,?defStyleAttr);
????}
??public?boolean?isFocused(){
??????return?true;
??}

}
主程序:
package?com.example.lenovo.learn;

import?android.support.v7.app.AppCompatActivity;
import?android.os.Bundle;
import?android.view.View;
import?android.widget.ArrayAdapter;
import?android.widget.AutoCompleteTextView;
import?android.widget.Button;
import?android.widget.Toast;

public?class?MainActivityLearn?extends?AppCompatActivity?{
????private?Button?loginButton;
????private?AutoCompleteTextView?acTextView;
????private?String[]?res={"beijing1","beijing2","beijing3","guangzhou1","shanghai","shandong"};

????@Override
????protected?void?onCreate(Bundle?savedInstanceState)?{
????????super.onCreate(savedInstanceState);
????????setContentView(R.layout.layout);

????????/*
????????1.初始化控件
????????2.設置監(jiān)聽器,實現(xiàn)效果。
?????????*/
????????loginButton?=(Button)?findViewById(R.id.button);
????????loginButton.setOnClickListener(new?View.OnClickListener()?{
????????????@Override
????????????public?void?onClick(View?v)?{
????????????????System.out.println("來玩虛榮?。?!來玩虛榮?。?!");
????????????????Toast.makeText(MainActivityLearn.this,?"來玩虛榮?。。硗嫣摌s?。。?,?Toast.LENGTH_SHORT).show();
????????????}
????????});


????????//初始化控件
????????acTextView?=?(AutoCompleteTextView)?findViewById(R.id.autoCompleteTextView);
????????//適配器,初始化數(shù)據(jù)源
????????ArrayAdapter<String>?adapter=new?ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,res);
????????//綁定方法
????????acTextView.setAdapter(adapter);
????}


}

最后在模擬機中運行的時候,一開始是正常的,但一旦點擊文本框準備輸入的時候(選中文本框的時候),上面的走馬燈效果就會消失,就是停住了不動了,請教各位大神是什么地方出現(xiàn)了問題,求解答,要是有解決方案就更好了,感激。

正在回答

3 回答

把android:focusable="true"這行代碼刪掉就可以了,這行代碼是指鍵盤選定,百度上有更詳細的解釋

0 回復 有任何疑惑可以回復我~
#1

deemos 提問者

好的,感激回復
2017-07-16 回復 有任何疑惑可以回復我~
#2

deemos 提問者

嘗試了,很有用,感激?。。。。。?!
2017-07-21 回復 有任何疑惑可以回復我~

我覺得多半是焦點問題,當你點擊輸入文本框時,這時候的焦點是輸入文本框,你可以查查focusable和focusableInTouchMode的相關內容,應該可以找到修改的方法,祝你學習愉快。

0 回復 有任何疑惑可以回復我~
#1

deemos 提問者

感激,我回去好好看看
2017-07-16 回復 有任何疑惑可以回復我~

我也是混在一起做的但是沒有你的問題啊。。。你是用的鍵盤點擊的還是鼠標點擊的啊?

0 回復 有任何疑惑可以回復我~
#1

deemos 提問者

鼠標點擊的時候就停止走馬燈效果了
2017-07-16 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Android攻城獅的第一門課(入門篇)
  • 參與學習       312507    人
  • 解答問題       4931    個

想快速掌握Android應用開發(fā)基礎,選擇學習這門課程就對了。

進入課程

我把走馬燈效果和自動匹配放在一個程序里卻沒法運行,求助大神們?。?!

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號