2016-10-11 46 views
1

說明我需要從一類從不同的封裝改性劑的方法如何擴展和改性劑在不同的封裝的java類 - 內

封裝結構

AndroidApp ---

  -- dependencies " materialSheetFab" 

materialSheetFab ---

   -- src 
        ... 
        --MaterialSheetAnimation.class 

        ---MaterialSheetFab 

materialSheetAnimation,我需要在此改變

public void alignSheetWithFab(View fab) { 
    .... 

    if (rightDiff != 0) { // need to remove this block of code 
     ..... 
    } 

的方法被稱爲在MaterialSheetFab

protected void morphIntoSheet(final AnimationListener endListener) { 

    // Align sheet's position with FAB 
    sheetAnimation.alignSheetWithFab(fab); 

的問題是在materialsheetAnimation成員變量的私人所以

public class Sample extend MaterialSheetAnimat{ 
    ...... 
    @overide 
    public void AlignSheetWithFab(Fab){ 
    .... 
    //remove code 
    // but cant call any instance variable there all private 
    // sheet is private member // sheet.setX(fab.coord[0]; not possible 

甚至延伸的類犯規允許我重寫了我所在的代碼塊

回答

0

Bbut的問題是在materialsheetAnimation成員變量是私有所以即使擴展類的犯規讓我重寫代碼塊

我intereested這是一個private成員的定義,不能覆蓋它。