Ⅰ android如何做類似淘寶那樣,把按鈕固定底部,點擊按鈕跳到別的界面,底部按鈕不會改變呢
fragment知道吧
創建一個activity,布局是
<?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:background="@color/activity_bg_default"
android:orientation="vertical">
<Fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/material_text_color_black_divider" />
<RadioGroup
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="7dp">
<RadioButton
android:id="@+id/bottom_bar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="0"
android:button="@null"
android:checked="true"
android:drawableBottom="@drawable/main_bottom_btn1" />
<RadioButton
android:id="@+id/bottom_bar2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@null"
android:tag="1"
android:drawableBottom="@drawable/main_bottom_btn2" />
<ImageButton
android:id="@+id/bottom_center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="@color/activity_bg_default"
android:src="@drawable/ic_main_center" />
<RadioButton
android:id="@+id/bottom_bar3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:tag="2"
android:button="@null"
android:drawableBottom="@drawable/main_bottom_btn3" />
<RadioButton
android:id="@+id/bottom_bar4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@null"
android:tag="3"
android:drawableBottom="@drawable/main_bottom_btn4" />
</RadioGroup>
</LinearLayout>
然後會用 就創建四個fragment,在activity利用hide和show的特性對應radiobutton來做點擊切換。
不會用立刻去網路,給你上一課,不會的要網路。提問太慢了
Ⅱ 怎樣把button放在屏幕底部
目前介紹一下css寫法,固定在瀏覽器的下邊的<style>
Ⅲ 怎樣令Button固定在ScrollView底部
按照你的需求你可以考慮做兩個按鈕,判斷ScrollView的內容是不是超出了整個屏幕的高度 超過的就把底下的按鈕顯示出來
Ⅳ android中怎樣把一個button按鈕放到屏幕底部
長按你想要的按鈕,直到機子震動,這時把按鈕拖到底部的某個位置。
Ⅳ android 中button怎麼固定位置
這要看你的布局了
在你布局時,採用RelativeLayout,然後選定一個參照物,比如一個id="+@id/textview1" layout_width="fill_parent" layout_height="grap_content"的textview
你就可以在button的屬性里控制它的位置
layout_below設置在textview下方
layout_toleftof 設置在textview左邊
layout_alighTop 設置頂端與textview頂端對齊
總之,layout_下還有好多屬性能幫你完全控制控制項的位置,只要有個參照物就行~~~
Ⅵ 安卓怎麼設置button的位置設置
第一種,帶動畫的改變
//位移動畫 從左到右參數分別為
//x軸方向起始位置x差值 ,x軸方向結束位置x差值 , y軸方向起始位置y差值 ,y軸方向結束位置y差值
TranslateAnimation translateAnimation = new TranslateAnimation(fromXDelta,toXDelta,fromYDelta,toYDelta);
translateAnimation.setDuration(300); //設置動畫世界
button.setAnimation(translateAnimation);
上面的示例只是許多動畫中的一種簡單地位移動畫,如果有興趣可以查閱一下android動畫方面的知識
第二種,直接改變控制項的位置
這種方法裡面也有2種不用的情況
//這是第一種 直接付給此button新的xy坐標
button.setX();
button.setY();
Ⅶ 在寫安卓應用時 怎麼在其他界面添加button
你可以能過 廣播通信,點擊第一個Activity 的button ,發一個廣播,第二個Activity收到後,把隱藏的Button,顯示出來(默認隱藏)或者直接代碼添加一個Button也可以。
Ⅷ android button控制項始終顯示在listview的上面
用FrameLayout或者RelativeLayout把ListView和button放進去,然後ListView在前面,button在後面,這樣就是button蓋住ListView而不是反過來。
Ⅸ android 怎麼將按鈕固定
你是在新的Activity 上嗎?
那你布局文件中 可以用RelativeLayout 布局,在兩個按鈕(btn)中設置兩個屬性, android:layout_alignParentBottom="true"給你寫個小例子
<RelativeLayout android:layout_w........>
<LinearLayout
andorid:Layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
>
<Button
andorid:Layout_width="wrap_contenti"
android:layout_height="wrap_content"
android:layout_gravity=''center"
android:text="確定"
/>
<Button
andorid:Layout_width="wrap_contenti"
android:layout_height="wrap_content"
android:layout_gravity=''center"
android:text="返回"
/>
</LinearLayout>
</RelativeLayout >
這樣就差不多吧 你也沒說清楚 不清楚你說的固定 是啥固定
Ⅹ android中,如果想要一個固定高度的BUTTON,一直在layout的最下面顯示,應該如何布局呢
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="30dp"/>
<!--這里的weight是關鍵-->
<View
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="30dp"/>
</LinearLayout>