The chart view was match_parent. This problem happens due to the TextView which resides left to the chart view. From the layout picture I posted, we can see after rotaion, the TextView still occupy the room before it's rotated. So is there any way to make a widget to only occupy a necessary room after rotation? Alternatively, it's also a good solution to make the text aligning in the manner like it's rotated. Is it possible?
在 2013年4月26日星期五UTC+8下午10时06分14秒,bob写道: > 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. >> >> >> <https://lh4.googleusercontent.com/-qw0ryGAA_6A/UXo1t4C2RjI/AAAAAAAAAA8/Buvso--p66I/s1600/chart1.png> >> >> >> 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 [email protected] To unsubscribe from this group, send email to [email protected] 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

