Ⅰ 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>