簡體   English   中英

android:layout_alignParentRight =“true”不起作用

[英]android:layout_alignParentRight=“true”doesn't work

我在LinearLayout有一個FrameLayout ,我想把它放在右邊。 試過android:layout_alignParentRight="true"但似乎沒有用。 有什么想法嗎? 請參閱下面的代碼:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="@dimen/gap_normal"
    android:orientation="horizontal"
    android:background="@color/grey"
    android:layout_alignParentRight="true">


    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="right"
        android:layout_alignParentRight="true">

        <ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/pb"
            android:visibility="invisible"/>

        <CheckableImageButton
            android:id="@+id/conference_checkableimagebutton_lockstate"
            android:layout_width="60dp"
            android:layout_height="match_parent"
            android:scaleType="fitCenter"
            android:adjustViewBounds="true"
            android:background="@android:color/white"
            android:src="@drawable/conference_checkableimagebutton_lockstate_src"
            android:cropToPadding="false"/>

    </FrameLayout>

    <com.devspark.robototextview.widget.RobotoTextView
        android:id="@+id/conference_text_lockstate"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/gap_normal"
        android:layout_marginBottom="@dimen/gap_normal"
        android:gravity="left"
        android:textSize="@dimen/textsize_normal"
        android:paddingRight="@dimen/gap_large"
        android:text="Unlocked. When all participants have joined, lock the conference by tapping the padlock."
        app:typeface="roboto_condensed_regular" />

</LinearLayout>    

試試這個代碼:

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" > 


<FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="right"
        android:layout_alignParentRight="true">

        <ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/pb"
            android:visibility="invisible"/>

        <CheckableImageButton
            android:id="@+id/conference_checkableimagebutton_lockstate"
            android:layout_width="60dp"
            android:layout_height="match_parent"
            android:scaleType="fitCenter"
            android:adjustViewBounds="true"
            android:background="@android:color/white"
            android:src="@drawable/conference_checkableimagebutton_lockstate_src"
            android:cropToPadding="false"/>

        </FrameLayout>

    <com.devspark.robototextview.widget.RobotoTextView
        android:id="@+id/conference_text_lockstate"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/gap_normal"
        android:layout_marginBottom="@dimen/gap_normal"
        android:gravity="left"
        android:textSize="@dimen/textsize_normal"
        android:paddingRight="@dimen/gap_large"
        android:text="Unlocked. When all participants have joined, lock the conference by tapping the padlock."
        app:typeface="roboto_condensed_regular" />





</RelativeLayout>   

android:layout_alignParentRight=“true”doesn't work ,因為您的父級是LinearLayout alignParentRight (以及所有其他相關屬性)僅適用於RelativeLayouts

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM