Friday, April 26, 2013

[android-developers] Re: Android widget layout doesn't change after rotation

Maybe make the chart view wider?


What did you set the width of the chart view to?  If it is wrap_content, I would at least try match_parent.


Thanks.



On Friday, April 26, 2013 3:10:39 AM UTC-5, zhiyazw wrote:

See the layout xml:

    <LinearLayout xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity" xmlns:android="http://schemas.android.com/apk/res/android">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="10dp"
        android:text="Temperature Chart"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <LinearLayout
        android:id="@+id/chartContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textTemperature"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:transformPivotX="0sp"
            android:translationY="0sp"
            android:rotation="-90"
            android:text="Temperature" />

    </LinearLayout>

</LinearLayout>
 
then I insert a chart view into the "chartContainer" LinearLayout. The executing result is as the following picture:
you can see the problem is, after "textTemperature" is rotated, it still occupy the room as before it rotated, bellow layout view confirmed this.


My question is how can I make the "textTemperature" widget only occupy the width as it is looked like? that's, there is no additional blank between "textTemperature" and the chart.
I know writing a customized widget or putting the rotated widget in an individual FrameLayout could accomplish this, I mean to seek there is any lighter way, such as a property, etc.

 

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment