开发者

Pop up view different orientation problem in Android

I have got horizontal oriented view and i want to show vertical oriented pop up view on it. Even i set vertical orientation on my pop up layer view it looks horizontal.

My pop Up view xml is :

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android" 
  android:weightSum="1" android:orientation="vertical"
   android:layout_width="wrap_content" android:layout_height="fill_parent">
    <LinearLayout android:id="@+id/linearLayout1" andro开发者_运维技巧id:layout_height="wrap_content" android:layout_weight="0.35" android:layout_width="321dp">
        <Button android:text="Button" android:id="@+id/button1" android:layout_height="wrap_content" android:layout_width="fill_parent"></Button>
    </LinearLayout>

</LinearLayout>

And on my manifest file xml:

    <activity android:name="PopUpLayer" android:label="@string/app_name" 
        android:theme="@android:style/Theme.Dialog" >

Thanks for any help.


I don't think that you can have landscape view and portrait popup at the same time if that's what you mean.


I changed your xml as follows.Now check.

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android" 
  android:weightSum="1" android:orientation="vertical"
   android:layout_width="wrap_content" android:layout_height="fill_parent">
    <LinearLayout android:id="@+id/linearLayout1" android:layout_height="wrap_content" android:layout_weight="0.35" android:layout_width="321dp" android:orientation="vertical">
        <Button android:text="Button" android:id="@+id/button1" android:layout_height="wrap_content" android:layout_width="fill_parent"></Button>
    </LinearLayout>

</LinearLayout>

If not work then see this:

 <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
        <LinearLayout android:layout_width="wrap_content" android:orientation="vertical" android:layout_height="match_parent" android:id="@+id/linearLayout1">

 <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
        <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>   
        </LinearLayout>


    </LinearLayout>

Okay.Now see the output of the following xml.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <LinearLayout android:layout_width="wrap_content" android:orientation="horizontal" android:layout_height="match_parent" android:id="@+id/linearLayout1">
    <Button android:text="Button" android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
    <Button android:text="Button" android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
     </LinearLayout>


</LinearLayout>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜