所以我有一個LinearLayout
有兩個視圖,我正在爲每個視圖設置權重。用LinearLayout和重量改變能見度
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_layout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:gravity="center"
android:orientation="horizontal">
<com.sorted.view.SorteddTextView
android:id="@+id/percent1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/normal"
android:layout_marginRight="@dimen/small"
android:layout_weight="2"
android:background="@color/sky_blue"
android:gravity="center"
android:text="0%"
android:textColor="@color/font_color"
android:textSize="@dimen/font_size_large"
android:visibility="invisible" />
<FrameLayout
android:id="@+id/frame1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8">
......
......
</FrameLayout>
</LinearLayout>
現在,我首先將活動的可見性設置爲GONE
。然後在某個按鈕上按下,我將可見性設置爲VISIBLE
,但我無法看到視圖。 但是當能見度是INVISIBLE
,然後如果我將其更改爲VISIBLE
其工作正常。
我認爲是LinearLayout
無法調整其視圖(以及我不知道)。
什麼問題? –
總之無法可見不工作。不可見可見工作良好的視圖 –