Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A AndroidSlidingUpPanel
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 267
    • Issues 267
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 34
    • Merge requests 34
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Umano: News Read To You
  • AndroidSlidingUpPanel
  • Issues
  • #137
Closed
Open
Issue created Mar 25, 2014 by Administrator@rootContributor

gravity top and set layout_height issue

Created by: mustafaerturk

if gravity is bottom everything work perfect but change gravity bottom to top sliding panel not work correctly. closev1

public class DemoActivity extends Activity implements OnClickListener {

Button openButton;
SlidingUpPanelLayout layout;
RelativeLayout panelLayout;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    setContentView(R.layout.activity_demo);

    openButton = (Button) findViewById(R.id.open_panel);
    openButton.setOnClickListener(this);

    panelLayout=(RelativeLayout)findViewById(R.id.panel_view);
    layout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
    layout.setShadowDrawable(getResources().getDrawable(R.drawable.above_shadow));
    layout.setSlidingEnabled(false);
    layout.setEnableDragViewTouchEvents(true);
}

@Override
public void onClick(View v) {
    if (!layout.isExpanded()) {
        layout.expandPane();
        openButton.setText("close");
    } else {
        layout.collapsePane();
        openButton.setText("open");
    }
}

demo.xml

<com.sothree.slidinguppanel.SlidingUpPanelLayout
    xmlns:sothree="http://schemas.android.com/apk/res-auto"
    android:id="@+id/sliding_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="top"
    sothree:collapsedHeight="68dp"
    sothree:shadowHeight="4dp">

    <TextView
        android:id="@+id/main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:background="#ffd700" />

    <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:background="#003366"
            android:id="@+id/panel_view">

        <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="68dp"
                android:layout_alignParentBottom="true"
                android:background="@android:color/white"
                android:id="@+id/container">
            <Button
                    android:id="@+id/open_panel"
                    android:layout_width="68dp"
                    android:layout_height="68dp"
                    android:textSize="16sp"
                    android:textStyle="bold"
                    android:text="open"
                    android:layout_centerVertical="true"/>
        </RelativeLayout>
    </RelativeLayout>      
</com.sothree.slidinguppanel.SlidingUpPanelLayout>
Assignee
Assign to
Time tracking