android去掉點擊效果
1. android textview activity中怎麼控製取消點擊事件
首先設定TextView的clickable屬性為true。
可以在布局文件中進行設定,比如:
<TextView
android:id="@+id/phone"
android:clickable="true" --------->設定此屬性
android:layout_marginLeft="10dp"
android:layout_below="@id/address"
android:layout_toRightOf="@id/avatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="18764563523"
android:textColor="@color/white" />
也可以在java代碼中設定:
textView.setClickable(true);
然後綁定事件回調函數:
textView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
//調到撥號界面
Uri uri = Uri.parse("tel:18764563501");
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
startActivity(intent);
}
});
3
完成TextView的點擊事件綁定!
2. android radiobutton點擊後一直是選中狀態,怎麼再點擊後取消選中
設置一個全局變數為RadioButton的狀態,設置RadioButton點擊監聽事件,監聽你是否點擊按鈕,如果按鈕是點擊狀態,那再次點擊後就會取消選中。

代碼如下:
final RadioButton rb_bug = (RadioButton) view.findViewById(R.id.rb_buy);
final GlobalValue globalValue = new GlobalValue();
rb_bug.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
boolean isCheck = globalValue.isCheck();
if(isCheck)
{
if(v==rb_bug)rb_bug.setChecked(false);
}
else
{
if(v==rb_bug)rb_bug.setChecked(true);
}
globalValue.setCheck(!isCheck);
}
});
public class GlobalValue {
public boolean isCheck() {
return isCheck;
}
public void setCheck(boolean check) {
isCheck = check;
}
private boolean isCheck;
}
(2)android去掉點擊效果擴展閱讀:
RadioButton使用步驟
1、RadioButton是圓形單選框
2、RadioGroup是個可以容納多個RadioButton的容器。
3、在RadioGroup中的RadioButton控制項可以有多個,但同時有且僅有一個可以被選中。
代碼如下:
<?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:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="請選擇性別" />
<RadioGroup
android:id="@+id/rg_sex"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/rb_Male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="男" />
<RadioButton
android:id="@+id/rb_FeMale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="女" />
</RadioGroup>
</LinearLayout>
網路:RadioButton
3. android 怎麼去掉ToolBar默認點擊效果
設置一下actionBar的背景顏色。
在styles文件中apptheme下添加actionbaritembackground
4. android怎麼去掉控制項點擊效果
在Android開發中,是不能取消點擊效果的,但是在開發中要給ListView取消點擊效果是設置點擊後的效果為透明色,這樣就可以認為是取消了點擊效果,設置方法如下:
1、首先使用Android studio創建一個Android項目,如下圖:
2、打開該項目的布局文件,如下圖所示:
3、添加一個ListView控制項,並設置其寬高,如下圖:
4、添加android:listSelector="@android:color/transparent",@android:color/transparent表示為android源碼中自定義的顏色,顏色為透明色
5. Android 自定義鍵盤點擊按鍵出現的浮層怎樣去掉
那個不是TextView是EditText,你只要把EditText放在Button上面就行了代碼如下:粘進去運行就行了activity隨便寫個就行記得配manifest~~~
6. android中如何去掉點擊鍵盤的浮層
方法一
在你的activity中的oncreate中setContentView之前寫上這個代碼
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
方法二
在 項目的AndroidManifest.xml文件中界面對應的<activity>里加入
這樣會讓屏幕整體上移。如果加上的 是 android:windowSoftInputMode="adjustPan"這樣鍵盤就會覆蓋屏幕。
關於android:windowSoftInputMode
activity主窗口與軟鍵盤的交互模式,可以用來避免輸入法面板遮擋問題,Android1.5後的一個新特性。
這個屬性能影響兩件事情:
【一】當有焦點產生時,軟鍵盤是隱藏還是顯示
【二】是否減少活動主窗口大小以便騰出空間放軟鍵盤
它的設置必須是下面列表中的一個值,或一個」state…」值加一個」adjust…」值的組合。在任一組設置多個值——多個」state…」values,例如&mdash有未定義的結果。各個值之間用|分開。
例如:
<activityandroid:windowSoftInputMode="stateVisible|adjustResize". . . >
在這設置的值(除"stateUnspecified"和"adjustUnspecified"以外)將覆蓋在主題中設置的值
方法三
把頂級的layout替換成ScrollView,或者說在頂級的Layout上面再加一層ScrollView。這樣就會把軟鍵盤和輸入框一起滾動了,軟鍵盤會一直處於底部。
7. Android ListView怎麼取消點擊效果
listview的默認樣式每個item都會有個選擇器(selector),要取消點擊效果就要替換掉這個默認的選擇器,使用listview.setSelector(new ColorDrawable(Color.TRANSPARENT))將選擇器替換成透明的drawable,點擊就不會有高亮的效果了。或者你想自定義一種點擊效果,那就定義好自己selector文件,然後在代碼中用setSelector或者在布局中ListView上用android:listSelector屬性來指定成自己的selector。PS:setSelector(null)是沒用的,還會有默認的點擊效果。
8. android中如何設置圖片按鈕的點擊效果,就是一點擊圖片,會顯示一種被按下去的感覺,而不是買有任何反應
可以使用這樣的一個xml布局
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
// 獲取焦點時候按鈕的背景狀態
<item android:drawable="@drawable/btn_green_pressed" android:state_enabled="true" android:state_focused="true"/>
// 被按下時候按鈕的背景狀態
<item android:drawable="@drawable/btn_green_pressed" android:state_enabled="true" android:state_pressed="true"/>
//正常狀態下按鈕的狀態
<item android:drawable="@drawable/btn_green_normal"/>
</selector>
把按鈕的背景設置為這個布局引用就行了.試試吧騷年
9. android 如何去掉listview 點擊時候的抖動效果和高亮
需要item_pressed="ture"啊什麼的。在裡面將選中效果設置為透明就可以了,點擊時候高亮就沒有了。
