[英]Android Sliding Pane Layout not sliding?
Hey so I'm trying to figure out how the Sliding Pane layout works. 嗨,所以我想弄清楚“滑动窗格”布局是如何工作的。 I set up a fairly simple example based on the following post: Exploring Sliding Panel Layout .
我根据以下文章建立了一个非常简单的示例: 探索滑动面板布局 。
The example compiles and runs but I don't quite understand how the sliding is supposed to work. 该示例可以编译并运行,但我不太了解滑动应如何工作。 All I get is 2 static panels on my screen that do not move.
我得到的是屏幕上没有移动的2个静态面板。 What am I missing here?
我在这里想念什么? Thanks
谢谢
activity_slide_panel.xml activity_slide_panel.xml
<android.support.v4.widget.SlidingPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView android:layout_width="250dp"
android:layout_height="match_parent"
android:background="#CC00FF00"
android:text="Pane 1" />
<TextView android:layout_width="400dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#CC0000FF"
android:text="Pane 2" />
</android.support.v4.widget.SlidingPaneLayout>
SlidePanel.java SlidePanel.java
public class SlidePanel extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_slide_panel);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.slide_panel, menu);
return true;
}
}
** **
Sorry I didn't provide enough information, nor did I understand what I was doing. 抱歉,我没有提供足够的信息,也不了解我在做什么。 I am using a tablet horizontally.
我正在水平使用平板电脑。 As soon as I used a phone with a smaller screen, it began working.
当我使用屏幕较小的手机后,它便开始工作。
Problem is in the second pane width. 问题出在第二窗格的宽度上。 Set second pane width to match-parent.
将第二个窗格的宽度设置为“ parent-match”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.