繁体   English   中英

我想添加底部选项,如图所示

[英]I want to add bottom options as shown in image

底部的选项如何标记为黄色,如下图所示?

图片

我尝试使用工具栏选项,但未显示所有图标。 它仅显示3个点

您可以添加linearlayoutrelativeLayout并给予linearLayout属性align_parent_bottom="true" ,然后添加buttonslinearlayout

尝试此代码,可能会对您有所帮助。

<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:background="#ff4081"
android:padding="2dp">
<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:layout_weight="1"
    android:src="@drawable/ic_a"
    android:layout_margin="1dp"/>
<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:layout_margin="1dp"
     android:src="@drawable/ic_b"/>
<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:layout_margin="1dp"
     android:src="@drawable/ic_c"/>
<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:layout_margin="1dp"
    android:src="@drawable/ic_d"/>

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:layout_margin="1dp"
    android:src="@drawable/ic_e"/> </LinearLayout>

这是我在一个应用程序中使用的代码示例:

<?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="#000000"
    android:orientation="vertical" >
    <ListView
            android:id="@+id/list"
            android:layout_width="match_parent"
            android:layout_height="398dp"
            android:layout_weight="1.44"
            android:scaleType="fitXY"
            android:choiceMode="none"
            android:scrollingCache="false"
            android:scrollbarThumbVertical="@drawable/scrollbar_thumb" >
        </ListView>  

 <FrameLayout
     android:id="@+id/frame3"
     android:layout_width="234dp"
     android:layout_height="30dp"
     android:background="#000000"
     android:visibility="gone"
     android:layout_gravity="center" >

      <TextView
          android:id="@+id/marquee"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:ellipsize="marquee"
          android:focusable="true"
          android:focusableInTouchMode="true"
          android:freezesText="false"
          android:marqueeRepeatLimit="marquee_forever"
          android:padding="5dp"
          android:scrollHorizontally="true"
          android:singleLine="true"
          android:text="frhjlhjkhjkhjkhjkghh jhgfsgewdfewt rewgwrhwghgfjghkhjljghjhgjhg"

          android:textColor="#ffffff" />

               </FrameLayout>

 <FrameLayout 
             android:id="@+id/frame2"
              android:layout_width="match_parent"
              android:layout_height="40dp"
               android:visibility="gone">
         <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#000000"
        android:gravity="bottom"
        android:stretchColumns="0,1"
        android:padding="2dp" >
          <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"

            android:scaleType="fitXY" >

               <TextView
                 android:id="@+id/current"  
                android:layout_width="50dp"
                android:layout_height="40dp" 
                android:text=""
                android:gravity="center"
                android:textColor="#FACC2E"

                />


               <SeekBar
                   android:id="@+id/seekBar1"
                   android:layout_width="190dp"
                   android:layout_height="wrap_content"
                   android:layout_marginTop="6dp"
                   android:gravity="center"
                   android:max="5"
                   android:maxHeight="5dp"

                   />
                <ImageButton
                   android:id="@+id/shuff"
                   android:layout_width="25dp"
                   android:layout_height="25dp"
                   android:layout_marginTop="6dp"
                   android:background="@null"
                   android:src="@drawable/shuff_off" />

                <TextView
                    android:id="@+id/runtime"
                    android:layout_width="50dp"
                    android:layout_height="40dp"
                    android:gravity="center"
                    android:paddingLeft="2dp"
                    android:textColor="#ff0000" />



              </TableRow>
              </TableLayout>
          </FrameLayout>
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="63dp" >
           <TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#000000"
        android:gravity="bottom"
        android:scaleType="fitXY"
        android:padding="2dp" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center_horizontal"
            android:scaleType="fitXY" >

            <ImageButton
                android:id="@+id/prev"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#000000"
                android:padding="8dp"
                android:src="@drawable/prev" />
            <TextView
                android:layout_width="15dp"
                android:layout_height="wrap_content" 

                android:scaleType="fitXY"
                />

            <ImageButton
                android:id="@+id/play"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#000000"
                android:padding="8dp"
                android:src="@drawable/play" />
            <TextView
                android:layout_width="15dp"
                android:layout_height="wrap_content" 

                android:scaleType="fitXY"
                />

            <ImageButton
                android:id="@+id/next"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#000000"
                android:padding="8dp"
                android:src="@drawable/next" />
        </TableRow>

    </TableLayout>
    </FrameLayout>

</LinearLayout>

和图像: 在此处输入图片说明

我在这里使用了线性布局和框架布局来进行更好的设计,在最后一帧中,我使用了一个表格布局来保持按钮的显示效果。 如果您在理解此代码时遇到问题,可以问我。 :)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM