android相對(duì)布局水平平分父控件容器-創(chuàng)新互聯(lián)

剛才用相對(duì)布局的時(shí)候,需要用到子控件水平平分父控件的容器??墒窃诎俣壬险伊税胩鞗](méi)有什么可行的辦法,所以就自己研究了下?,F(xiàn)在我發(fā)現(xiàn)了一種比較麻煩的方法,不過(guò)能解決問(wèn)題也算可以了,如果有朋友有更好的方法,希望不吝告訴下。好了,我所說(shuō)的方法就是,在兩個(gè) button 中間 再放一個(gè)textview 或者其他什么的,只是用來(lái)作為一個(gè)中間位置參考的,將textView 設(shè)置水平居中(android:layout_centerHorizontal="true"),然后 分別將需要水平平分父容器的兩個(gè)button 設(shè)置 android:layout_toLeftOf="@+id/textview " 和 android:layout_toRightOf="@+id/textview" 屬性,最后將兩個(gè)button的寬度設(shè)置fill_parent 就行了。

10年積累的成都網(wǎng)站制作、成都做網(wǎng)站經(jīng)驗(yàn),可以快速應(yīng)對(duì)客戶(hù)對(duì)網(wǎng)站的新想法和需求。提供各種問(wèn)題對(duì)應(yīng)的解決方案。讓選擇我們的客戶(hù)得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識(shí)你,你也不認(rèn)識(shí)我。但先網(wǎng)站制作后付款的網(wǎng)站建設(shè)流程,更有秀峰免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。

下面是測(cè)試的布局代碼:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.first_summary.MainActivity$PlaceholderFragment" >

    <ImageButton
        android:id="@+id/ImageButton"
        android:contentDescription="@+id/ImageButton"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />
    
    <Button 
        android:id="@+id/up"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/ImageButton"
        android:layout_toLeftOf="@+id/cencer"
        android:textSize="12sp"
        android:text="上傳數(shù)據(jù)"
        />
    <TextView
        android:id="@+id/cencer"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_below="@+id/ImageButton"
        android:layout_centerHorizontal="true"
        />
     <Button 
        android:id="@+id/add"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/ImageButton"
        android:layout_toRightOf="@+id/cencer"
        android:textSize="12sp"
        android:text="添加數(shù)據(jù)"
        />
  </RelativeLayout>

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性?xún)r(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專(zhuān)為企業(yè)上云打造定制,能夠滿(mǎn)足用戶(hù)豐富、多元化的應(yīng)用場(chǎng)景需求。

分享文章:android相對(duì)布局水平平分父控件容器-創(chuàng)新互聯(lián)
網(wǎng)頁(yè)路徑:http://bm7419.com/article14/dgdide.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開(kāi)發(fā)商城網(wǎng)站、網(wǎng)站排名、做網(wǎng)站、營(yíng)銷(xiāo)型網(wǎng)站建設(shè)電子商務(wù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化