English 中文(简体)
提要 氯乙烯不开放
原标题:Sliding drawer Android does not open

我已安装了一台推土机,当露面显示4吨时,但在我试图点击时,这从来不是实际发生的(推土机不开放)。 然而,在一点点击推器时,部分图像观察手的图像资源会发生变化。

我有以下XML守则:

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

        <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:layout_marginTop="10dp"
        android:layout_weight="0.1"
        android:orientation="horizontal" >
             .
             .
             .

        </LinearLayout>

            <LinearLayout
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/LinearLayout01"
                android:layout_width="fill_parent"
                android:layout_height="42dp"
                android:layout_weight="0.1"
                android:gravity="bottom"
                android:orientation="vertical" >

                <SlidingDrawer
                    android:id="@+id/slidingDrawer1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@drawable/bar"
                    android:content="@+id/contentLayout"
                    android:handle="@+id/handle" >

                    <ImageView
                        android:id="@+id/handle"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:layout_weight="1" />

                    <LinearLayout
                        android:id="@+id/contentLayout"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:background="@color/white" >

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

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

                        <Button
                            android:id="@+id/button3"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="Button" />

                        <Button
                            android:id="@+id/button4"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:text="Button" />
                    </LinearLayout>
                </SlidingDrawer>

            </LinearLayout>

和java法典:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(com.android.layout.R.layout.channelprogrammation);

    drawer = (SlidingDrawer) findViewById(com.android.layout.R.id.slidingDrawer1);
        // Drawer Programmation
    drawer.setOnDrawerOpenListener(new OnDrawerOpenListener() {
        public void onDrawerOpened() {
            ImageView view = (ImageView) drawer.getHandle();
            // change to bar selected   
               view.setImageResource(com.android.layout.R.drawable.ic_launcher);
            Toast.makeText(getApplicationContext(), "Is open!", 3000)
                    .show();
            drawer.open();
        }
    });
    drawer.setOnDrawerCloseListener(new OnDrawerCloseListener() {

        public void onDrawerClosed() {
            Toast.makeText(getApplicationContext(), "Closed", 3000).show();
            ImageView view = (ImageView) drawer.getHandle();
            view.setImageResource(0);
            drawer.close();
        }
    });
最佳回答

我发现问题...... 我的直线布局有42页的倾斜线。 因此,在试图利用滑动推土时,布局已经开放,但没有足够的空间扩大。

问题回答

Look看其非常容易的手法,在密码简单布局中划出任何东西,将完美地为一方倾斜。

检查布局

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg"
    android:orientation="vertical" >



        <TextView
            android:id="@+id/text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="60dp"
            android:layout_marginTop="20dp"
            android:text="Your Location"
            android:textColor="#ff0000ff"
            android:textStyle="normal" />

        </LinearLayout>
<SlidingDrawer
  android:id="@+id/drawer"
  android:layout_width="match_parent"
     android:layout_height="match_parent"
  android:orientation="horizontal"
  android:layout_gravity="left"
  android:handle="@+id/handle"
  android:content="@+id/content"
 >
  <ImageView 
   android:id="@+id/handle"
   android:layout_width="wrap_content"
   android:layout_height="fill_parent" 
   android:src="@drawable/tag"/>

  <LinearLayout
      android:id="@+id/content"
      android:layout_width="wrap_content"
      android:layout_height="fill_parent"
      android:background="@drawable/slidimage"
      android:orientation="vertical"
      android:layout_gravity="right"
      android:padding="10dp" >
 <TextView
            android:id="@+id/text1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="15dp"
            android:layout_marginLeft="51dp"
            android:text="SIGN-UP"
            android:textColor="#000000"
            android:textSize="28dp"
            android:textStyle="bold" />

       <Button
           android:id="@+id/sign_up"
           android:layout_width="110dp"
           android:layout_height="55dp"
           android:layout_marginLeft="35dp"
           android:layout_marginTop="20dp"
           android:background="@drawable/signup"
           android:text="Cancel"
           android:textColor="#ffffffff"
           android:textSize="20dp" />

       <Button
           android:id="@+id/cancelbtn"
           android:layout_width="110dp"
           android:layout_height="55dp"
           android:layout_marginTop="20dp"
           android:layout_marginLeft="18dp"

           android:background="@drawable/liginbtn"
            android:text="Sign up"
           android:textColor="#ffffffff"
           android:textSize="20dp" />
   </LinearLayout>

  </LinearLayout>
 </SlidingDrawer>
</FrameLayout>

甲状腺 code。

       public class MainActivity extends Activity {
/** Called when the activity is first created. */

     @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.xml);

}
  }




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签